Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Nov 26, 2023
1 parent 84cd743 commit ec6bdd8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
2 changes: 2 additions & 0 deletions tests/ProfanityFilter.Action.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

global using Microsoft.Extensions.DependencyInjection;

global using Actions.Octokit.EnvironmentVariables;

global using ProfanityFilter.Action.Extensions;

global using ProfanityFilter.Services;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@ public class ServiceCollectionExtensionsTests
[Fact]
public void AddProfanityFilter_AddsServices()
{
// Arrange
var services = new ServiceCollection();
Environment.SetEnvironmentVariable(Keys.GITHUB_TOKEN, "TEST");

// Act
services.AddActionProcessorServices();
try
{
// Arrange
var services = new ServiceCollection();

// Assert
var provider = services.BuildServiceProvider();
var censorService = provider.GetService<IProfaneContentCensorService>();
// Act
services.AddActionProcessorServices();

Assert.NotNull(censorService);
Assert.IsType<DefaultProfaneContentCensorService>(censorService);
// Assert
var provider = services.BuildServiceProvider();
var censorService = provider.GetService<IProfaneContentCensorService>();

Assert.NotNull(censorService);
Assert.IsType<DefaultProfaneContentCensorService>(censorService);
}
finally
{
Environment.SetEnvironmentVariable(Keys.GITHUB_TOKEN, null);
}
}
}

0 comments on commit ec6bdd8

Please sign in to comment.