-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds test generation unit test that instantiates and validates all sc…
…enario generators
- Loading branch information
1 parent
c962eec
commit cbe21c4
Showing
9 changed files
with
48 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
using Btms.BlobService; | ||
using Btms.BlobService.Extensions; | ||
using FluentAssertions; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using TestDataGenerator.Extensions; | ||
using TestDataGenerator.Scenarios; | ||
using Xunit; | ||
|
||
namespace TestDataGenerator.Tests; | ||
|
||
public class ScenarioTests | ||
{ | ||
[Fact] | ||
public void EnsureAllScenarioDefaultsAreValid() | ||
ServiceProvider _serviceProvider = BuilderExtensions.GetDefaultServiceProvider(); | ||
|
||
public static IEnumerable<object[]> GetAllScenarios() | ||
{ | ||
return BuilderExtensions | ||
.GetAllScenarios() | ||
.Select(s => new object[] { s }); | ||
} | ||
|
||
[Theory] | ||
[MemberData(nameof(GetAllScenarios))] | ||
public void EnsureAllScenarioDefaultsAreValid(Type scenarioType) | ||
{ | ||
// var (configuration, _) = BuilderExtensions.GetConfig("Scenarios/Samples"); | ||
// | ||
// var sp = new ServiceCollection() | ||
// .AddBlobStorage(configuration) | ||
// .AddSingleton<CachingBlobService>() | ||
// .ConfigureTestGenerationServices() | ||
// .BuildServiceProvider(); | ||
|
||
var scenarioTypes = BuilderExtensions.GetAllScenarios(); | ||
|
||
foreach (var scenarioType in scenarioTypes) | ||
var scenario = (ScenarioGenerator)_serviceProvider.GetRequiredService(scenarioType); | ||
var config = new ScenarioConfig() | ||
{ | ||
|
||
} | ||
Name = "Test", ArrivalDateRange = 1, Count = 1, Generator = scenario, CreationDateRange = 1 | ||
}; | ||
|
||
var messages = scenario.Generate(1, 1, DateTime.Today, config); | ||
|
||
messages.Should().NotBeNull(); | ||
messages.Should().NotBeEmpty(); | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
TestDataGenerator/Scenarios/Samples/chedpp-multiple-commodity.json
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