Beispiel #1
0
        public void LocationNode_Method_SavetoDB(string Platform, string Electrification, SimSigLocationType LocationType, int?Length, bool FreightOnly, string Line, string Path)
        {
            Length TestLength = null;

            if (Length != null)
            {
                TestLength = new Length(Convert.ToInt32(Length));
            }

            Core.SimSig.LocationNode TestLocationNode = new Core.SimSig.LocationNode(this._TestSimulation.ID, this._TestLocation.SimSigCode, this._TestSimulation.GetSimulationEras().Find(x => x.Type == EraType.Template).ID, this._TestVersion, Platform, new Core.Electrification(Electrification), LocationType, TestLength, FreightOnly, Line, Path, this._SQLConnection);
            TestLocationNode.SaveToSQLDB();
            Assert.Equal(LocationType, TestLocationNode.LocationType);
            Assert.Equal(Platform, TestLocationNode.Platform);
            Assert.Equal(Line, TestLocationNode.Line);
            Assert.Equal(Path, TestLocationNode.Path);
            Assert.Equal(this._TestLocation.SimSigCode, TestLocationNode.LocationSimSigCode);
            Assert.Equal(this._TestLocation.ID, TestLocationNode.LocationID);

            if (Length == null)
            {
                Assert.Null(TestLocationNode.Length);
            }
            else
            {
                Assert.Equal(TestLength.Meters, TestLocationNode.Length.Meters);
            }

            Assert.Equal(FreightOnly, TestLocationNode.FreightOnly);
            Assert.Equal(new Electrification(Electrification).BitWise, TestLocationNode.Electrification.BitWise);
            Assert.NotEqual(0, TestLocationNode.ID);
        }
Beispiel #2
0
        public void LocationNode_Constructor_GroundFrameDBID(string Platform, string Electrification, SimSigLocationType LocationType, int?Length, bool FreightOnly, string Line, string Path)
        {
            Length TestLength = null;

            if (Length != null)
            {
                TestLength = new Length(Convert.ToInt32(Length));
            }

            SimulationEra SimEra = this._TestSimulation.GetSimulationEras().Find(x => x.Type == EraType.Template);

            Core.Electrification     ElecObject       = new Core.Electrification(Electrification);
            Core.SimSig.LocationNode TestLocationNode = new Core.SimSig.LocationNode(this._TestSimulation.ID, this._TestLocation.SimSigCode, SimEra.ID, this._TestVersion, Platform, ElecObject, LocationType, TestLength, FreightOnly, Line, Path, this._SQLConnection);
            TestLocationNode.SaveToSQLDB();
            Assert.Equal(LocationType, TestLocationNode.LocationType);
            Assert.Equal(Platform, TestLocationNode.Platform);
            Assert.Equal(Line, TestLocationNode.Line);
            Assert.Equal(Path, TestLocationNode.Path);
            Assert.Equal(this._TestLocation.SimSigCode, TestLocationNode.LocationSimSigCode);
            Assert.Equal(this._TestLocation.ID, TestLocationNode.LocationID);

            if (Length == null)
            {
                Assert.Null(TestLocationNode.Length);
            }
            else
            {
                Assert.Equal(TestLength.Meters, TestLocationNode.Length.Meters);
            }

            Assert.Equal(FreightOnly, TestLocationNode.FreightOnly);
            Assert.Equal(new Electrification(Electrification).BitWise, TestLocationNode.Electrification.BitWise);
            Assert.NotEqual(0, TestLocationNode.ID);

            //Load the LocationNode into a new object and compare
            Core.SimSig.LocationNode TestLoadLocationNode = new Core.SimSig.LocationNode(TestLocationNode.ID, this._SQLConnection, true);

            Assert.Equal(TestLocationNode.LocationType, TestLoadLocationNode.LocationType);
            Assert.Equal(TestLocationNode.Platform, TestLoadLocationNode.Platform);
            Assert.Equal(TestLocationNode.Line, TestLoadLocationNode.Line);
            Assert.Equal(TestLocationNode.Path, TestLoadLocationNode.Path);
            Assert.Equal(TestLocationNode.LocationSimSigCode, TestLoadLocationNode.LocationSimSigCode);
            Assert.Equal(TestLocationNode.LocationID, TestLoadLocationNode.LocationID);

            if (TestLocationNode.Length == null)
            {
                Assert.Null(TestLoadLocationNode.Length);
            }
            else
            {
                Assert.Equal(TestLocationNode.Length.Meters, TestLoadLocationNode.Length.Meters);
            }

            Assert.Equal(TestLocationNode.FreightOnly, TestLoadLocationNode.FreightOnly);
            Assert.Equal(TestLocationNode.Electrification.BitWise, TestLoadLocationNode.Electrification.BitWise);
            Assert.Equal(TestLocationNode.ID, TestLoadLocationNode.ID);
        }