Exemplo n.º 1
0
        private void CreateBuildRequest()
        {
            ///////////////////////////////////////////////////////////////
            // Serialize Build Request data structure

            "Creating Build Request".Title();
            Console.WriteLine();

            // CSharp Build pass and Tests pass
            var te1 = new TestElement("test1", "csharp");

            te1.addDriver("TestDriver.cs");
            te1.addCode("Tested1.cs");
            te1.addCode("Tested2.cs");

            // Java Build pass and Tests pass
            var te2 = new TestElement("test2", "java");

            te2.addDriver("TestDriver.java");
            te2.addCode("Tested1.java");
            te2.addCode("Tested2.java");

            // CSharp Build pass and Tests Fail
            var te3 = new TestElement("test3", "csharp");

            te3.addDriver("TestDriver1.cs");
            te3.addCode("Tested3.cs");

            // CSharp Build Fail
            var te4 = new TestElement("test4", "csharp");

            te4.addDriver("TestDriverBuildFail.cs");
            te4.addCode("Tested1.cs");
            te4.addCode("Tested2.cs");

            var tr = new BuildRequest("Jim Fawcett");

            tr.tests.Add(te1);
            tr.tests.Add(te2);
            tr.tests.Add(te3);
            tr.tests.Add(te4);
            var trXml = tr.ToXml();

            Console.Write("\n  Serialized TestRequest data structure:\n\n  {0}\n", trXml);
            File.WriteAllText(RepoStorage + "/BuildRequest.xml", trXml);
        }
Exemplo n.º 2
0
        //Builds the Testrequest instance from the build request.
        private static TestRequest BuildTestRequest(BuildRequest buildRequest)
        {
            var tr = new TestRequest("Jim Fawcett");

            foreach (var test in buildRequest.tests)
            {
                var te = new TestElement(test.testName, test.toolchain);
                if (test.toolchain == "csharp")
                {
                    te.addDriver(test.testDriver.Remove(test.testDriver.LastIndexOf(".", StringComparison.Ordinal)) + ".dll");
                    te.addCode(test.testName + ".dll");
                }
                else if (test.toolchain == "java")
                {
                    te.addDriver(test.testDriver.Remove(test.testDriver.LastIndexOf(".", StringComparison.Ordinal)) + ".java");
                }
                tr.tests.Add(te);
            }
            return(tr);
        }