Esempio n. 1
0
        public void ResolveSetup_3DefaultSetups2LevelsDeepWithExpansionsReversePriority()
        {
            // Arrange...
            var configLibrary = new List <Config>()
            {
                Config.New("D[1]")
                .AddProperty("a", "1"),
                Config.New("D[2]")
                .AddProperty("a", new[] { "2.1", "2.2" }),
                Config.New("D[3]")
                .AddProperty("IMPORT.DefaultSetup", "D[2]")
            };

            var testConfig = Config.New("TestConfig")
                             .AddProperty("IMPORT.DefaultSetup", "D[3]")
                             .AddProperty("IMPORT.DefaultSetup2", new[] { "D[1]" });

            var expectedCases = new[] {
                "p:a(1)",
            };

            // Act...
            var testCases = TestCaseLoader.CasesFromConfigs(testConfig, configLibrary);

            // Assert
            var testCaseString = testCases.Select(tc => TestCaseLoader.CaseToString(tc)).ToList();

            CollectionAssert.AreEquivalent(expectedCases, testCaseString);
        }
Esempio n. 2
0
        public void ResolveSetup_2DefaultSetupsWithExpandedProperties()
        {
            // Arrange...
            var configLibrary = new List <Config>()
            {
                Config.New("D[1]")
                .AddProperty("a", new[] { "1", "2", "3" })
                .AddProperty("b", "1"),
                Config.New("D[2]")
                .AddProperty("a", new[] { "4", "5" })
                .AddProperty("c", "1")
            };

            var testConfig = Config.New("TestConfig")
                             .AddProperty("IMPORT.DefaultSetup", new[] { "D[1]" })
                             .AddProperty("IMPORT.DefaultSetup2", new[] { "D[2]" })
                             .AddProperty("d", "1");

            var expectedCases = new[] {
                "p:a(4) p:b(1) p:c(1) p:d(1)",
                "p:a(5) p:b(1) p:c(1) p:d(1)"
            };

            // Act...
            var testCases = TestCaseLoader.CasesFromConfigs(testConfig, configLibrary);

            // Assert
            var testCaseString = testCases.Select(tc => TestCaseLoader.CaseToString(tc)).ToList();

            CollectionAssert.AreEquivalent(expectedCases, testCaseString);
        }
Esempio n. 3
0
        public void ResolveSetup_1ExpandedDefaultSetupsEachWith2ExpandedProperties()
        {
            // Arrange...
            var configLibrary = new List <Config>()
            {
                Config.New("D[1]")
                .AddProperty("a", new[] { "T", "F" }),
                Config.New("D[2]")
                .AddProperty("b", new[] { "T", "F" })
            };

            var testConfig = Config.New("TestConfig")
                             .AddProperty("IMPORT.DefaultSetup", new[] { "D[1]", "D[2]" })
                             .AddProperty("c", new[] { "T", "F" });

            var expectedCases = new[] {
                "p:a(T) p:c(T)",
                "p:a(T) p:c(F)",
                "p:a(F) p:c(T)",
                "p:a(F) p:c(F)",
                "p:b(T) p:c(T)",
                "p:b(T) p:c(F)",
                "p:b(F) p:c(T)",
                "p:b(F) p:c(F)"
            };

            // Act...
            var testCases = TestCaseLoader.CasesFromConfigs(testConfig, configLibrary);

            // Assert
            var testCaseString = testCases.Select(tc => TestCaseLoader.CaseToString(tc)).ToList();

            CollectionAssert.AreEquivalent(expectedCases, testCaseString);
        }
Esempio n. 4
0
        public void ResolveSetup()
        {
            // Arrange...
            var configLibrary = new List <Config>()
            {
                Config.New("D[1]")
                .AddProperty("a", "1")
            };

            var testConfig = Config.New("TestConfig")
                             .AddProperty("IMPORT.DefaultSetup", "D[1]")
                             .AddProperty("b", "1");

            var expectedCases = new[] {
                "p:a(1) p:b(1)"
            };

            // Act...
            var testCases = TestCaseLoader.CasesFromConfigs(testConfig, configLibrary);

            // Assert
            var testCaseString = testCases.Select(tc => TestCaseLoader.CaseToString(tc)).ToList();

            CollectionAssert.AreEquivalent(expectedCases, testCaseString);
        }
Esempio n. 5
0
        public void ExpandSetup_GivenPermutationSet_Expect4Permutations()
        {
            // Arrange...
            var configLibrary = new List <Config>();
            var config        = Config.New("TestConfig")
                                .AddProperty("a", new [] { "1", "2" })
                                .AddProperty("b", new [] { "1", "2" })
                                .AddProperty("c", "1");

            var expectedCases = new[] {
                "p:a(1) p:b(1) p:c(1)",
                "p:a(1) p:b(2) p:c(1)",
                "p:a(2) p:b(1) p:c(1)",
                "p:a(2) p:b(2) p:c(1)"
            };

            // Act...
            var testCases = TestCaseLoader.CasesFromConfigs(config, configLibrary);

            // Assert
            var testCaseString = testCases.Select(tc => TestCaseLoader.CaseToString(tc)).ToList();

            Assert.AreEqual(4, testCases.Count());
            CollectionAssert.AreEquivalent(expectedCases, testCaseString);
        }
Esempio n. 6
0
        public void ExpandSetup_GivenPermutationSet_Expect1Permutation()
        {
            // Arrange...
            var configLibrary = new List <Config>();
            var config        = Config.New("TestConfig")
                                .AddProperty("a", "1")
                                .AddProperty("b", "1")
                                .AddProperty("c", "1");
            var expectedCases = new[] {
                "p:a(1) p:b(1) p:c(1)"
            };

            // Act...
            var nodeTree  = TestCaseLoader.NodeTreeFromConfigs(config, configLibrary);
            var testCases = TestCaseLoader.CasesFromNodeTree(nodeTree);

            // Assert...
            var testCaseString = testCases.Select(tc => TestCaseLoader.CaseToString(tc)).ToList();

            Assert.AreEqual(expectedCases, testCaseString);
        }