-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Fazzani/feature/add-more-unit-tests
feat: Add more unit tests
- Loading branch information
Showing
17 changed files
with
257 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using FluentAssertions; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Moq; | ||
using Proxarr.Api.Core; | ||
using Proxarr.Api.HostedServices; | ||
|
||
namespace Proxarr.Api.Tests | ||
{ | ||
public class ScheduledServiceExtensionsTests | ||
{ | ||
[Fact] | ||
public void AddCronJob_ShouldThrowNullException_WhenOptionsNull() | ||
{ | ||
IServiceCollection services = new ServiceCollection(); | ||
Action act = () => services.AddCronJob<FullScanHostedService>(null); | ||
act.Should().Throw<ArgumentNullException>().WithParameterName("options").WithMessage("Please provide Schedule Configurations. (Parameter 'options')"); | ||
} | ||
|
||
[Fact] | ||
public void AddCronJob_ShouldThrowNullException_WhenCronIsNull() | ||
{ | ||
IServiceCollection services = new ServiceCollection(); | ||
Action act = () => services.AddCronJob<FullScanHostedService>(x => x.CronExpression = string.Empty); | ||
act.Should().Throw<ArgumentNullException>().WithParameterName("options").WithMessage("Empty Cron Expression is not allowed. (Parameter 'options')"); | ||
} | ||
|
||
[Fact] | ||
public void AddCronJob_ShouldAddHostedService() | ||
{ | ||
IServiceCollection services = new ServiceCollection(); | ||
Action act = () => services.AddCronJob<FullScanHostedService>(x => x.CronExpression = "* * * * *"); | ||
act.Should().NotThrow(); | ||
} | ||
} | ||
} |
Oops, something went wrong.