Example #1
0
        public void Returnsᅠexpectedᅠstepsᅠwhenᅠseedᅠbucketᅠcontainsᅠseveralᅠscenarios()
        {
            // The dependancy graph:
            // FirstSeed ____
            // |             \
            // SecondSeed    /
            // |            /
            // FirstScenario
            // |             \
            // ThirdSeed      |
            // |             /
            // SecondScenario

            var seedBucket = assemblyBuilder
                             .AddSeedBucket()
                             .AddSeed("FirstSeed")
                             .AddSeed(seedTypeName: "SecondSeed", requires: "FirstSeed")
                             .AddScenario(scenarioTypeName: "FirstScenario", requires: new[] { "FirstSeed", "SecondSeed" })
                             .AddSeed(seedTypeName: "ThirdSeed", requires: "FirstScenario")
                             .AddScenario(scenarioTypeName: "SecondScenario", requires: new[] { "ThirdSeed", "FirstScenario" })
                             .BuildAssembly()
                             .GetSeedBucket();

            var seedingPlan = SeedingPlan.CreateFor(seedBucket.GetMetaInfo());

            seedingPlan.SeedingSteps
            .Select(seedInfo => seedInfo.FullName)
            .Should()
            .BeEquivalentTo(new[] { "FirstSeed", "SecondSeed", "ThirdSeed" }, options => options.WithStrictOrdering());
        }
Example #2
0
        public void Returnsᅠemptyᅠlistᅠwhenᅠseedᅠbucketᅠdoesᅠnotᅠcontainᅠanyᅠseeds()
        {
            var seedBucket = assemblyBuilder.AddSeedBucket().BuildAssembly().GetSeedBucket();

            var seedingPlan = SeedingPlan.CreateFor(seedBucket.GetMetaInfo());

            seedingPlan.SeedingSteps.Should().BeEmpty();
        }
Example #3
0
        public void Returnsᅠsingleᅠseedᅠwhenᅠseedᅠbucketᅠcontainsᅠonlyᅠoneᅠseed()
        {
            var seedBucket = assemblyBuilder
                             .AddSeedBucket()
                             .AddSeed("SingleSeed")
                             .BuildAssembly()
                             .GetSeedBucket();

            var seedingPlan = SeedingPlan.CreateFor(seedBucket.GetMetaInfo());

            seedingPlan.SeedingSteps
            .Should().ContainSingle(seedInfo => seedInfo.FullName.EndsWith("SingleSeed"));
        }
Example #4
0
        public async Task ReturnsᅠSeedingSingleSeedFailedᅠwhenᅠsomeᅠseedsᅠsucceedᅠandᅠmiddleᅠoneᅠfails()
        {
            var seedBucket = assemblyBuilder
                             .AddSeedBucket()
                             .AddSeed("FirstSeed", hasAlreadyYielded: false)
                             .AddSeed("SecondSeed", hasAlreadyYielded: true, requires: "FirstSeed")
                             .AddSeed("ThirdSeed", hasAlreadyYielded: false, requires: "SecondSeed")
                             .AddSeed("FailingSeed", fails: true, hasAlreadyYielded: false, requires: "ThirdSeed")
                             .AddSeed("FourthSeed", hasAlreadyYielded: false, requires: "FailingSeed")
                             .AddSeed("FifthSeed", hasAlreadyYielded: true, requires: "FourthSeed")
                             .AddSeed("SixthSeed", hasAlreadyYielded: false, requires: "FifthSeed")
                             .BuildAssembly()
                             .GetSeedBucket();

            var seedBucketInfo = seedBucket.GetMetaInfo();

            seedBucketInfo.HasAnyErrors.Should().BeFalse();

            var result = await seeder.Seed(seedBucket.GetType());

            result.Status.Should().BeEquivalentTo(SeedingStatus.SeedingSingleSeedFailed);
            result.SeedBucketInfo.Should().BeEquivalentTo(seedBucketInfo, option =>
                                                          option.IgnoringCyclicReferences());
            result.SeedingPlan.Should().BeEquivalentTo(SeedingPlan.CreateFor(seedBucketInfo), option =>
                                                       option.IgnoringCyclicReferences());
            result.SingleSeedSeedingResults
            .Should()
            .HaveCount(4)
            .And
            .ContainSingle(seedingResult => seedingResult.Status == SingleSeedSeedingStatus.Failed)
            .Which
            .SeedInfo.FullName.Should().EndWith("FailingSeed");
            result.SingleSeedSeedingResults.Last().Status
            .Should().BeEquivalentTo(SingleSeedSeedingStatus.Failed);
            result.SingleSeedSeedingResults
            .Where(seedingResult => seedingResult.Status == SingleSeedSeedingStatus.Skipped)
            .Select(seedingResult => seedingResult.SeedInfo.FullName)
            .Should()
            .HaveCount(1)
            .And
            .Contain("SecondSeed");
            result.SingleSeedSeedingResults
            .Where(seedingResult => seedingResult.Status == SingleSeedSeedingStatus.Seeded)
            .Select(seedingResult => seedingResult.SeedInfo.FullName)
            .Should()
            .HaveCount(2)
            .And
            .Contain("FirstSeed", "ThirdSeed");
        }
Example #5
0
        public void Returnsᅠexpectedᅠstepsᅠwhenᅠseedᅠbucketᅠcontainsᅠseveralᅠdisjunctᅠindependentᅠscenarios()
        {
            // The dependancy graph:
            // FirstSeed01 ____
            // |               \
            // SecondSeed01    /
            // |              /
            // FirstScenario01
            // |               \
            // ThirdSeed01      |
            // |               /
            // SecondScenario01
            //
            // FirstSeed02 ____
            // |               \
            // SecondSeed02    /
            // |              /
            // FirstScenario02
            // |               \
            // ThirdSeed02      |
            // |               /
            // SecondScenario02

            var seedBucket = assemblyBuilder
                             .AddSeedBucket()
                             .AddSeed("FirstSeed01")
                             .AddSeed(seedTypeName: "SecondSeed01", requires: "FirstSeed01")
                             .AddScenario(scenarioTypeName: "FirstScenario01", requires: new[] { "FirstSeed01", "SecondSeed01" })
                             .AddSeed(seedTypeName: "ThirdSeed01", requires: "FirstScenario01")
                             .AddScenario(scenarioTypeName: "SecondScenario01", requires: new[] { "ThirdSeed01", "FirstScenario01" })
                             .AddSeed("FirstSeed02")
                             .AddSeed(seedTypeName: "SecondSeed02", requires: "FirstSeed02")
                             .AddScenario(scenarioTypeName: "FirstScenario02", requires: new[] { "FirstSeed02", "SecondSeed02" })
                             .AddSeed(seedTypeName: "ThirdSeed02", requires: "FirstScenario02")
                             .AddScenario(scenarioTypeName: "SecondScenario02", requires: new[] { "ThirdSeed02", "FirstScenario02" })
                             .BuildAssembly()
                             .GetSeedBucket();

            var seedingPlan = SeedingPlan.CreateFor(seedBucket.GetMetaInfo());

            seedingPlan.SeedingSteps
            .Select(seedInfo => seedInfo.FullName)
            .Should()
            .BeEquivalentTo("FirstSeed01", "SecondSeed01", "ThirdSeed01", "FirstSeed02", "SecondSeed02", "ThirdSeed02")
            .And
            .ContainInOrder("FirstSeed01", "SecondSeed01", "ThirdSeed01")
            .And
            .ContainInOrder("FirstSeed02", "SecondSeed02", "ThirdSeed02");
        }
Example #6
0
        public void Returnsᅠexpectedᅠstepsᅠwhenᅠseedᅠbucketᅠcontainsᅠdisjunctᅠindependentᅠseeds()
        {
            var seedBucket = assemblyBuilder
                             .AddSeedBucket()
                             .AddSeed("FirstSeed")
                             .AddSeed("SecondSeed")
                             .AddSeed("ThirdSeed")
                             .BuildAssembly()
                             .GetSeedBucket();

            var seedingPlan = SeedingPlan.CreateFor(seedBucket.GetMetaInfo());

            seedingPlan.SeedingSteps
            .Select(seedInfo => seedInfo.FullName)
            .Should()
            .BeEquivalentTo("FirstSeed", "SecondSeed", "ThirdSeed");
        }
Example #7
0
        public async Task ReturnsᅠSucceededᅠwhenᅠseedᅠbucketᅠhasᅠnoᅠseeds()
        {
            var seedBucket = assemblyBuilder
                             .AddSeedBucket()
                             .BuildAssembly()
                             .GetSeedBucket();

            var seedBucketInfo = seedBucket.GetMetaInfo();

            seedBucketInfo.HasAnyErrors.Should().BeFalse();

            var result = await seeder.Seed(seedBucket.GetType());

            result.Status.Should().BeEquivalentTo(SeedingStatus.Succeeded);
            result.SeedBucketInfo.Should().BeEquivalentTo(seedBucketInfo, option =>
                                                          option.IgnoringCyclicReferences());
            result.SeedingPlan.Should().BeEquivalentTo(SeedingPlan.CreateFor(seedBucketInfo), option =>
                                                       option.IgnoringCyclicReferences());
            result.SingleSeedSeedingResults.Should().BeEmpty();
        }
Example #8
0
        public async Task ReturnsᅠSeedingSingleSeedFailedᅠwhenᅠfirstᅠseedᅠfails()
        {
            var seedBucket = assemblyBuilder
                             .AddSeedBucket()
                             .AddSeed(fails: true)
                             .BuildAssembly()
                             .GetSeedBucket();

            var seedBucketInfo = seedBucket.GetMetaInfo();

            seedBucketInfo.HasAnyErrors.Should().BeFalse();

            var result = await seeder.Seed(seedBucket.GetType());

            result.Status.Should().BeEquivalentTo(SeedingStatus.SeedingSingleSeedFailed);
            result.SeedBucketInfo.Should().BeEquivalentTo(seedBucketInfo, option =>
                                                          option.IgnoringCyclicReferences());
            result.SeedingPlan.Should().BeEquivalentTo(SeedingPlan.CreateFor(seedBucketInfo), option =>
                                                       option.IgnoringCyclicReferences());
            result.SingleSeedSeedingResults
            .Should()
            .ContainSingle(seedingResult => seedingResult.Status == SingleSeedSeedingStatus.Failed);
        }