Ejemplo n.º 1
0
        public void SerializationBLLTest_Serialize_Deserialize_SkipInactiveEstw()
        {
            using (var settings = new SettingsScope())
            {
                settings.EstwTimeout       = 30;
                settings.LoadInactiveEstws = false;
                string Filename = "test.leibit";

                var Data = ExpectedValuesOfSerializationBLLTest.Serialize_Deserialize();
                Data.Area.ESTWs.Single(e => e.Id == "TREH").IsLoaded      = true;
                Data.Area.ESTWs.Single(e => e.Id == "TREH").LastUpdatedOn = DateTime.Now.AddSeconds(-40);

                var SaveResult = BLL.Save(Filename, Data);
                DefaultChecks.IsOperationSucceeded(SaveResult);

                SerializationContainer Actual;

                using (var scope = new ESTWTestDataScope(BLL))
                {
                    var OpenResult = BLL.Open(Filename);
                    DefaultChecks.IsOperationSucceeded(OpenResult);
                    Actual = OpenResult.Result;
                }

                var Expected = ExpectedValuesOfSerializationBLLTest.Serialize_Deserialize();
                AreaComparer.Instance.Compare(Expected.Area, Actual.Area);
                AreaComparer.CompareDictionary(Expected.Area.LiveTrains, Actual.Area.LiveTrains, TrainInformationComparer.Instance, "LiveTrains");
            }
        }
Ejemplo n.º 2
0
        public void SerializationBLLTest_Serialize_Deserialize()
        {
            using (var settings = new SettingsScope())
            {
                settings.LoadInactiveEstws = true;
                string Filename = "test.leibit";

                var Expected = ExpectedValuesOfSerializationBLLTest.Serialize_Deserialize();

                var SaveResult = BLL.Save(Filename, Expected);
                DefaultChecks.IsOperationSucceeded(SaveResult);

                SerializationContainer Actual;

                using (var scope = new ESTWTestDataScope(BLL))
                {
                    var OpenResult = BLL.Open(Filename);
                    DefaultChecks.IsOperationSucceeded(OpenResult);
                    Actual = OpenResult.Result;
                }

                AreaComparer.Instance.Compare(Expected.Area, Actual.Area);
                AreaComparer.CompareDictionary(Expected.Area.LiveTrains, Actual.Area.LiveTrains, TrainInformationComparer.Instance, "LiveTrains");
            }
        }