Esempio n. 1
0
        public void Location_Method_CheckUpdate(string TIPLOC, string Name, bool EntryPoint, string SimSigCode, int LocationType)
        {
            Core.SimSig.Location TestLocation = new Core.SimSig.Location(this._TestSimulation, Name, TIPLOC, SimSigCode, EntryPoint, (Core.SimSig.SimSigLocationType)LocationType, this._SQLConnection);
            TestLocation.SaveToSQLDB();

            Assert.Equal(Name, TestLocation.Name);
            Assert.Equal(TIPLOC, TestLocation.TIPLOC);
            Assert.Equal(EntryPoint, TestLocation.EntryPoint);
            Assert.Equal(SimSigCode, TestLocation.SimSigCode);
            Assert.NotEqual(0, TestLocation.ID);
            Assert.Equal((Core.SimSig.SimSigLocationType)LocationType, TestLocation.LocationType);

            int LocationID = TestLocation.ID;

            TestLocation.TIPLOC = string.Format(@"{0}_U", TIPLOC);

            TestLocation.SaveToSQLDB();

            Assert.Equal(LocationID, TestLocation.ID);
        }
Esempio n. 2
0
 public void Location_Constructor_ByProperties(string TIPLOC, string Name, bool EntryPoint, string SimSigCode, int LocationType)
 {
     Core.SimSig.Location TestLocation = new Core.SimSig.Location(this._TestSimulation, Name, TIPLOC, SimSigCode, EntryPoint, (Core.SimSig.SimSigLocationType)LocationType, this._SQLConnection);
     TestLocation.SaveToSQLDB();
     Assert.Equal(Name, TestLocation.Name);
     Assert.Equal(TIPLOC, TestLocation.TIPLOC);
     Assert.Equal(EntryPoint, TestLocation.EntryPoint);
     Assert.Equal(SimSigCode, TestLocation.SimSigCode);
     Assert.Equal((Core.SimSig.SimSigLocationType)LocationType, TestLocation.LocationType);
     Assert.NotEqual(0, TestLocation.ID);
 }
Esempio n. 3
0
        public void LocationCollection_Constructor_Default()
        {
            //Populate some data
            Core.SimSig.Simulation TestSim = new Core.SimSig.Simulation("LocColl Sim Name", "LocColl Sim Desc", null, "LocCollCode", this._SQLConnection);
            TestSim.SaveToSQLDB();
            Core.SimSig.Location TestLocation1 = new Core.SimSig.Location(TestSim, "LocColl Loc Name", null, "LocCollLocCode1", true, Core.SimSig.SimSigLocationType.Station, this._SQLConnection);
            TestLocation1.SaveToSQLDB();
            Core.SimSig.Location TestLocation2 = new Core.SimSig.Location(TestSim, "LocCol2 Loc Name", "LocCollTIPLOC2", "LocCollLocCode2", false, Core.SimSig.SimSigLocationType.Station, this._SQLConnection);
            TestLocation2.SaveToSQLDB();

            //Get Collection
            Core.SimSig.LocationCollection TestLocCollection = new Core.SimSig.LocationCollection(TestSim, this._SQLConnection);
            //Check 5 records are returned
            Assert.Equal(2, TestLocCollection.Count);
        }
Esempio n. 4
0
        public void Location_Method_CheckRefresh(string TIPLOC, string Name, bool EntryPoint, string SimSigCode, int LocationType)
        {
            Core.SimSig.Location TestLocation = new Core.SimSig.Location(this._TestSimulation, Name, TIPLOC, SimSigCode, EntryPoint, (Core.SimSig.SimSigLocationType)LocationType, this._SQLConnection);
            TestLocation.SaveToSQLDB();

            //Now load into a new object and compare

            Core.SimSig.Location CheckLocation = new Core.SimSig.Location(TestLocation.ID, this._SQLConnection);
            Assert.Equal(TestLocation.ID, CheckLocation.ID);
            Assert.Equal(TestLocation.Name, CheckLocation.Name);
            Assert.Equal(TestLocation.SimSigCode, CheckLocation.SimSigCode);
            Assert.Equal(TestLocation.EntryPoint, CheckLocation.EntryPoint);
            Assert.Equal(TestLocation.LocationType, CheckLocation.LocationType);

            string TestTIPLOC  = string.IsNullOrEmpty(TestLocation.TIPLOC) ? "NULL" : TestLocation.TIPLOC;
            string CheckTIPLOC = string.IsNullOrEmpty(CheckLocation.TIPLOC) ? "NULL" : CheckLocation.TIPLOC;

            Assert.Equal(TestTIPLOC, CheckTIPLOC);
        }