public void WTTCautionSpeedSetCollection_Constructor_XElement() { string TestXMLPath = $"{System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)}\\Resources\\TestThreeBridges_4.8.xml"; XElement XMLTestCautionSpeedSetCollection = XDocument.Load(TestXMLPath).Element("SimSigTimetable").Element("CautionSpeedSets"); GroundFrame.Core.Timetables.WTTCautionSpeedSetCollection TestCautionSpeedSetCollection = new Timetables.WTTCautionSpeedSetCollection(XMLTestCautionSpeedSetCollection); Assert.Equal(XMLTestCautionSpeedSetCollection.Elements("CautionSpeedSet").Count(), TestCautionSpeedSetCollection.Count()); }
public void WTTCautionSpeedSet_Constructor_JSON() { //Set up test string TestXMLPath = $"{System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)}\\Resources\\TestThreeBridges_4.8.xml"; XElement XMLTestCautionSpeedSetCollection = XDocument.Load(TestXMLPath).Element("SimSigTimetable").Element("CautionSpeedSets"); GroundFrame.Core.Timetables.WTTCautionSpeedSetCollection TestCautionSpeedSetCollection = new Timetables.WTTCautionSpeedSetCollection(XMLTestCautionSpeedSetCollection); string JSON = TestCautionSpeedSetCollection.ToJSON(); //Instantiate object from JSON GroundFrame.Core.Timetables.WTTCautionSpeedSetCollection TestJSONCautionSpeedSetCollection = new Timetables.WTTCautionSpeedSetCollection(JSON); Assert.Equal(XMLTestCautionSpeedSetCollection.Elements("CautionSpeedSet").Count(), TestJSONCautionSpeedSetCollection.Count); }