public void VerifyXML_MeteoData()
        {
            var model = createTestDataModel1Race1Run();

            fillMandatoryFields(model);

            // no eather set, check if weather is absent
            string s = exportToXML(model.GetRace(0));

            Assert.ThrowsException <Xunit.Sdk.TrueException>(() => XmlAssertion.AssertXPathExists("/dsv_alpine_raceresults/racedata/rundata[1]/meteodata", s));

            model.GetRace(0).AdditionalProperties.Weather = "sunny";
            s = exportToXML(model.GetRace(0));
            XmlAssertion.AssertXPathEvaluatesTo("/dsv_alpine_raceresults/racedata/rundata[1]/meteodata/weather", s, "sunny");


            Assert.ThrowsException <Xunit.Sdk.TrueException>(() => XmlAssertion.AssertXPathExists("/dsv_alpine_raceresults/racedata/rundata[1]/meteodata/snowtexture", s));
            model.GetRace(0).AdditionalProperties.Snow = "griffig";
            s = exportToXML(model.GetRace(0));
            XmlAssertion.AssertXPathEvaluatesTo("/dsv_alpine_raceresults/racedata/rundata[1]/meteodata/snowtexture", s, "griffig");


            Assert.ThrowsException <Xunit.Sdk.TrueException>(() => XmlAssertion.AssertXPathExists("/dsv_alpine_raceresults/racedata/rundata[1]/meteodata/temperature_startaltitude", s));
            model.GetRace(0).AdditionalProperties.TempStart = "-2";
            s = exportToXML(model.GetRace(0));
            XmlAssertion.AssertXPathEvaluatesTo("/dsv_alpine_raceresults/racedata/rundata[1]/meteodata/temperature_startaltitude", s, "-2");


            Assert.ThrowsException <Xunit.Sdk.TrueException>(() => XmlAssertion.AssertXPathExists("/dsv_alpine_raceresults/racedata/rundata[1]/meteodata/temperature_finishaltitude", s));
            model.GetRace(0).AdditionalProperties.TempFinish = "-1";
            s = exportToXML(model.GetRace(0));
            XmlAssertion.AssertXPathEvaluatesTo("/dsv_alpine_raceresults/racedata/rundata[1]/meteodata/temperature_finishaltitude", s, "-1");
        }
 [Test] public void AssertXPathExistsFailsForNonExistentXPath()
 {
     try {
         XmlAssertion.AssertXPathExists("//star[@name='alpha centauri']",
                                        MY_SOLAR_SYSTEM);
         Assertion.Fail("Expected assertion failure");
     } catch (AssertionException e) {
         AvoidUnusedVariableCompilerWarning(e);
     }
 }
        [Test] public void AssertXPathExistsFailsForNonExistentXPath()
        {
            bool caughtException = true;

            try {
                XmlAssertion.AssertXPathExists("//star[@name='alpha centauri']",
                                               MY_SOLAR_SYSTEM);
                caughtException = false;
            } catch (AssertionException e) {
                AvoidUnusedVariableCompilerWarning(e);
            }
            Assert.IsTrue(caughtException);
        }
        public void XmlSerializer()
        {
            string xml;

            LiveTimingFIS.LiveTimingFIS lt = new LiveTimingFIS.LiveTimingFIS();

            xml = lt.getXmlKeepAlive();
            XmlAssertion.AssertXPathExists("/livetiming/command/keepalive", xml);


            xml = lt.getXmlClearRace();
            XmlAssertion.AssertXPathExists("/livetiming/command/clear", xml);


            xml = lt.getXmlStatusUpdateInfo("test");
            XmlAssertion.AssertXPathExists("/livetiming/message", xml);
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/message", xml, "test");


            TestDataGenerator tg = new TestDataGenerator();
            var rp = tg.createRaceParticipant();
            var r  = tg.Model.GetRace(0);

            r.GetParticipant(1).Participant.Nation = "nation";
            r.GetParticipant(1).Participant.Code   = "123";
            var rr1 = r.GetRun(0);

            xml = lt.getXmlEventOnStart(r.GetParticipant(1));
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/raceevent/nextstart/@bib", xml, "1");

            xml = lt.getXmlEventStarted(r.GetParticipant(1));
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/raceevent/start/@bib", xml, "1");

            xml = lt.getXmlStartList(rr1);
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/startlist/@runno", xml, rr1.Run.ToString());
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/startlist/racer[1]/@order", xml, "1");
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/startlist/racer[1]/bib", xml, "1");
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/startlist/racer[1]/lastname", xml, r.GetParticipant(1).Name);
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/startlist/racer[1]/firstname", xml, r.GetParticipant(1).Firstname);
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/startlist/racer[1]/nat", xml, r.GetParticipant(1).Nation);
            XmlAssertion.AssertXPathEvaluatesTo("/livetiming/startlist/racer[1]/fiscode", xml, r.GetParticipant(1).Code);
        }
 [Test] public void AssertXPathExistsWorksForExistentXPath()
 {
     XmlAssertion.AssertXPathExists("//planet[@name='Earth']",
                                    MY_SOLAR_SYSTEM);
 }