public void Test3TestSiteName() { Console.WriteLine("Test3TestSiteName"); Assert.AreEqual(_testSite.SiteName, "h2g2"); SiteXmlBuilder siteXml = new SiteXmlBuilder(_inputcontext); XmlNode testnode = siteXml.GenerateXml(null, _testSite); DnaXmlValidator validator = new DnaXmlValidator(testnode.OuterXml, _schemaUri); validator.Validate(); if (testnode != null) { Assert.AreEqual(testnode.SelectSingleNode("NAME").InnerText, "h2g2", "Site Name Xml incorrect"); } }
public void Test2TestSiteID() { Console.WriteLine("Test2TestSiteID"); Assert.AreEqual(_testSite.SiteID, 1); SiteXmlBuilder siteXml = new SiteXmlBuilder(_inputcontext); XmlNode testnode = siteXml.GenerateXml(null, _testSite); DnaXmlValidator validator = new DnaXmlValidator(testnode.OuterXml, _schemaUri); validator.Validate(); if (testnode != null) { Assert.AreEqual(testnode.Attributes["ID"].InnerText, "1", "Site ID Attribute Xml incorrect"); } }
public void TestFTestSiteModerationStatus() { Console.WriteLine("TestFTestSiteModerationStatus"); Assert.AreEqual((int)_testSite.ModerationStatus, 0); SiteXmlBuilder siteXml = new SiteXmlBuilder(_inputcontext); XmlNode testnode = siteXml.GenerateXml(null, _testSite); DnaXmlValidator validator = new DnaXmlValidator(testnode.OuterXml, _schemaUri); validator.Validate(); if (testnode != null) { Assert.AreEqual(testnode.SelectSingleNode("MODERATIONSTATUS").InnerText, "0", "Site moderation status Xml incorrect"); } }
public void TestDTestScheduledClosedXml() { Console.WriteLine("TestDTestScheduledClosedXml"); SiteXmlBuilder siteXml = new SiteXmlBuilder(_inputcontext); XmlNode testnode = siteXml.GenerateXml(null, _testSite); DnaXmlValidator validator = new DnaXmlValidator(testnode.OuterXml, _schemaUri); validator.Validate(); if (testnode != null) { string testval = String.Empty; if (_testSite.IsSiteScheduledClosed(DateTime.Now)) { testval = "1"; } else { testval = "0"; } Assert.AreEqual(testnode.SelectSingleNode("SITECLOSED/@SCHEDULEDCLOSED").InnerText, testval, "Site Scheduled Close does not match Xml"); } }
public void Test8TestEmergencyClose() { Console.WriteLine("Test8TestEmergencyClose"); _testSite.IsEmergencyClosed = true; Assert.AreEqual(_testSite.IsEmergencyClosed, true, "Emergency Closed field failed to set"); SiteXmlBuilder siteXml = new SiteXmlBuilder(_inputcontext); XmlNode testnode = siteXml.GenerateXml(null, _testSite); DnaXmlValidator validator = new DnaXmlValidator(testnode.OuterXml, _schemaUri); validator.Validate(); if (testnode != null) { Assert.AreEqual(testnode.SelectSingleNode("SITECLOSED/@EMERGENCYCLOSED").InnerText, "1", "Site Emergency Closed Xml incorrect"); } }
public void Test7TestAddOpenCloseTimesTest() { Console.WriteLine("Test7TestAddOpenCloseTimesTest"); _testSite.AddOpenCloseTime(2, 23, 55, 1); _testSite.AddOpenCloseTime(2, 1, 5, 0); SiteXmlBuilder siteXml = new SiteXmlBuilder(_inputcontext); XmlNode testnode = siteXml.GenerateXml(null, _testSite); DnaXmlValidator validator = new DnaXmlValidator(testnode.OuterXml, _schemaUri); validator.Validate(); Assert.IsTrue(testnode != null, "Failed to generate xml for test site!!!"); if (testnode != null) { Assert.AreEqual(testnode.SelectSingleNode("OPENCLOSETIMES/OPENCLOSETIME").Attributes["DAYOFWEEK"].Value, "2", "Start Day Of week incorrect"); Assert.AreEqual(testnode.SelectSingleNode("OPENCLOSETIMES/OPENCLOSETIME/OPENTIME/HOUR").InnerText, "1", "Start Hour Of week incorrect"); Assert.AreEqual(testnode.SelectSingleNode("OPENCLOSETIMES/OPENCLOSETIME/OPENTIME/MINUTE").InnerText, "5", "Start Minute Of week incorrect"); Assert.AreEqual(testnode.SelectSingleNode("OPENCLOSETIMES/OPENCLOSETIME/CLOSETIME/HOUR").InnerText, "23", "End Hour Of week incorrect"); Assert.AreEqual(testnode.SelectSingleNode("OPENCLOSETIMES/OPENCLOSETIME/CLOSETIME/MINUTE").InnerText, "55", "End Minute Of week incorrect"); } }