public void SaveTest()
        {
            TrackLayoutSerializer target = new TrackLayoutSerializer("TestXmlSave.xml"); // TODO: Initialize to an appropriate value

            target.Save();
            // Can not find save directory for unit tests
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the track layout from file
        /// </summary>
        /// <param name="filename">File name</param>
        /// <returns>List of track blocks</returns>
        public List <TrackBlock> LoadTrackLayout(string filename)
        {
            List <TrackBlock>  blocks   = null;
            List <TrackSwitch> switches = null;

            try
            {
                TrackLayoutSerializer layoutSerializer = new TrackLayoutSerializer(filename);
                layoutSerializer.Restore();
                blocks   = layoutSerializer.BlockList;
                switches = layoutSerializer.SwitchList;
                if (BuildLayout(blocks, switches))
                {
                    m_updateTimer.Start();
                    m_log.LogInfo("Successfully loaded track layout. Starting update timer");
                }
                else
                {
                    m_log.LogError("Error building track layout");
                }
            }
            catch (Exception e)
            {
                m_log.LogError("Layout restoration failed", e);
            }

            return(blocks);
        }
        public void RestoreTest()
        {
            TrackLayoutSerializer target = new TrackLayoutSerializer(); // TODO: Initialize to an appropriate value

            target.Restore();
            Assert.IsTrue(true);
            // Needs a File to test.... We know this works because of the program
        }
 public void LastUpdatedTest()
 {
     TrackLayoutSerializer target = new TrackLayoutSerializer(); // TODO: Initialize to an appropriate value
     DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value
     DateTime actual;
     target.LastUpdated = expected;
     actual = target.LastUpdated;
     Assert.AreEqual(expected, actual);
     //Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public void LastUpdatedTest()
        {
            TrackLayoutSerializer target = new TrackLayoutSerializer(); // TODO: Initialize to an appropriate value
            DateTime expected            = new DateTime();              // TODO: Initialize to an appropriate value
            DateTime actual;

            target.LastUpdated = expected;
            actual             = target.LastUpdated;
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void SwitchListTest()
        {
            TrackLayoutSerializer target = new TrackLayoutSerializer("TestLine.xml"); // TODO: Initialize to an appropriate value

            target.CreateTrackLayoutFileRedLine();
            TrackLayoutSerializer target2 = new TrackLayoutSerializer("TestLine.xml"); // TODO: Initialize to an appropriate value

            target2.CreateTrackLayoutFileRedLine();
            List <TrackSwitch> expected = target2.SwitchList; // TODO: Initialize to an appropriate value
            List <TrackSwitch> actual;

            target.SwitchList = expected;
            actual            = target.SwitchList;
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
 public void RestoreTest()
 {
     TrackLayoutSerializer target = new TrackLayoutSerializer(); // TODO: Initialize to an appropriate value
     target.Restore();
     Assert.IsTrue(true);
     // Needs a File to test.... We know this works because of the program
 }
 public void SwitchListTest()
 {
     TrackLayoutSerializer target = new TrackLayoutSerializer("TestLine.xml"); // TODO: Initialize to an appropriate value
     target.CreateTrackLayoutFileRedLine();
     TrackLayoutSerializer target2 = new TrackLayoutSerializer("TestLine.xml"); // TODO: Initialize to an appropriate value
     target2.CreateTrackLayoutFileRedLine();
     List<TrackSwitch> expected = target2.SwitchList ; // TODO: Initialize to an appropriate value
     List<TrackSwitch> actual;
     target.SwitchList = expected;
     actual = target.SwitchList;
     Assert.AreEqual(expected, actual);
     //Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void SaveTest()
 {
     TrackLayoutSerializer target = new TrackLayoutSerializer("TestXmlSave.xml"); // TODO: Initialize to an appropriate value
     target.Save();
     // Can not find save directory for unit tests
 }