Exemplo n.º 1
0
        public void SaveAs(string filename)
        {
            var testSuite = new TestSuiteXml();
            var array = listTestXml.ToArray();
            testSuite.Load(array);

            testSuite.Settings = settingsXml;

            var manager = new XmlManager();
            manager.Persist(filename, testSuite);
        }
Exemplo n.º 2
0
 protected void Save(string filename, TestSuiteXml testSuite)
 {
     var xmlManager = new XmlManager();
     xmlManager.Persist(filename, testSuite);
 }
Exemplo n.º 3
0
        public void GetTestCases_TestCaseWithRegexName_ReplaceRegexByValueInName()
        {
            //Buiding object used during test
            //TestSuite invoked
            var test = new TestXml()
            {
                Name = "my name contains a regex '{sut:caption}' and it's parsed! Same for '{sut:display-folder}'.",
            };

            test.Systems.Add(
                new StructureXml()
                {
                    Item = new MeasureXml()
                    {
                        Caption="My Caption",
                        DisplayFolder = "My Display Folder"
                    }
                }
            );

            var testSuiteXml = new TestSuiteXml();
            testSuiteXml.Tests.Add(test);

            //Building a stub for TestSuiteManager
            var testSuiteManagerStub = new Mock<XmlManager>();
            testSuiteManagerStub.Setup(mgr => mgr.Load(It.IsAny<string>()));
            testSuiteManagerStub.Setup(mgr => mgr.TestSuite).Returns(testSuiteXml);

            //Building a stub for TestSuiteFinder
            var testSuiteFinderStub = new Mock<TestSuiteFinder>();
            testSuiteFinderStub.Setup(finder => finder.Find()).Returns(string.Empty);

            var testSuite = new TestSuite(testSuiteManagerStub.Object, testSuiteFinderStub.Object);

            //Call the method to test
            var testCases = testSuite.GetTestCases();
            var testCase = testCases.First();

            //Assertion
            Console.WriteLine(testCase.TestName);
            Assert.That(testCase.TestName, Is.StringContaining("my name contains a regex").And
                                            .StringContaining("My Caption").And
                                            .StringContaining("My Display Folder").And
                                            .StringContaining("and it's parsed!"));
        }