public void ConvertEngineResultToXml()
        {
            ServiceContext services = new ServiceContext();
            services.Add(new ExtensionService());
            ResultService resultService = new ResultService();
            services.Add(resultService);
            services.ServiceManager.StartServices();

            StringBuilder sb = new StringBuilder();
            using (StringWriter writer = new StringWriter(sb))
            {
                var nunit2Writer = resultService.GetResultWriter("nunit2", null);
                Assert.NotNull(nunit2Writer, "Unable to get nunit2 result writer");
                nunit2Writer.WriteResultFile(EngineResult.Xml, writer);
            }

            _doc = new XmlDocument();
            _doc.LoadXml(sb.ToString());

            _topNode = _doc.SelectSingleNode("/test-results");
            Assert.NotNull(_topNode, "Test-results element not found");

            _envNode = _topNode.SelectSingleNode("environment");
            Assert.NotNull(_envNode, "Environment element not found");

            _cultureNode = _topNode.SelectSingleNode("culture-info");
            Assert.NotNull(_topNode, "CultureInfo element not found");

            _fixtureNode = _topNode.SelectSingleNode("descendant::test-suite[@name='MockTestFixture']");
            Assert.NotNull(_fixtureNode, "MockTestFixture element not found");
        }
        public void ConvertEngineResultToXml()
        {
            StringBuilder sb = new StringBuilder();
            ResultService service = new ResultService();
            service.StartService();
            using (StringWriter writer = new StringWriter(sb))
            {
                service.GetResultWriter("nunit2", null).WriteResultFile(EngineResult.Xml, writer);
            }

            doc = new XmlDocument();
            doc.LoadXml(sb.ToString());

            topNode = doc.SelectSingleNode("/test-results");
            Assert.NotNull(topNode, "Test-results element not found");

            envNode = topNode.SelectSingleNode("environment");
            Assert.NotNull(envNode, "Environment element not found");

            cultureNode = topNode.SelectSingleNode("culture-info");
            Assert.NotNull(topNode, "CultureInfo element not found");

            fixtureNode = topNode.SelectSingleNode("descendant::test-suite[@name='MockTestFixture']");
            Assert.NotNull(fixtureNode, "MockTestFixture element not found");
        }
示例#3
0
 public void CreateService()
 {
     var services = new ServiceContext();
     services.Add(new ExtensionService());
     _resultService = new ResultService();
     services.Add(_resultService);
     services.ServiceManager.StartServices();
 }
        private void runSchemaValidatorTest()
        {
            StringBuilder output = new StringBuilder();

            ResultService service = new ResultService();
            service.StartService();
            service.GetResultWriter("nunit2", null).WriteResultFile(this.EngineResult.Xml, new StringWriter(output));

            if (!validator.Validate(new StringReader(output.ToString())))
            {
                StringBuilder errors = new StringBuilder("Validation Errors:" + Environment.NewLine);
                foreach (string error in validator.Errors)
                    errors.Append("    " + error + Environment.NewLine);
                Assert.Fail(errors.ToString());
            }
        }
示例#5
0
        private void runSchemaValidatorTest()
        {
            StringBuilder output = new StringBuilder();

            ServiceContext services = new ServiceContext();
            services.Add(new ExtensionService());
            ResultService service = new ResultService();
            services.Add(service);
            services.ServiceManager.StartServices();
            var nunit2Writer = service.GetResultWriter("nunit2", null);
            Assert.NotNull(nunit2Writer, "Unable to get nunit2 result writer");
            nunit2Writer.WriteResultFile(this.EngineResult.Xml, new StringWriter(output));

            if (!validator.Validate(new StringReader(output.ToString())))
            {
                StringBuilder errors = new StringBuilder("Validation Errors:" + Environment.NewLine);
                foreach (string error in validator.Errors)
                    errors.Append("    " + error + Environment.NewLine);
                Assert.Fail(errors.ToString());
            }
        }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CombinationResultService"/> class.
 /// </summary>
 /// <param name="connectionString">The connection string for the sql result service.</param>
 public CombinationResultService(string connectionString)
 {
     this.consoleResultService = new ConsoleResultService();
     var resultRepository = new SqlResultRepository(connectionString);
     this.sqlResultService = new ResultService(resultRepository);
 }
示例#7
0
 public void CreateService()
 {
     _resultService = new ResultService();
     _resultService.StartService();
 }