public void CalculationBLLTest_GetFollowUpService_WrongDay() { var estw = new ESTW("ID", "Name", string.Empty, null); estw.Time = new LeibitTime(eDaysOfService.Saturday, 14, 45); var train = new Train(1); new Schedule(train, new LeibitTime(14, 56), null, null, new List <eDaysOfService>(), eScheduleDirection.Unknown, eHandling.Destination, string.Empty); var relation = new TrainRelation(2); relation.Days.Add(eDaysOfService.Monday); relation.Days.Add(eDaysOfService.Tuesday); relation.Days.Add(eDaysOfService.Wednesday); relation.Days.Add(eDaysOfService.Thursday); relation.Days.Add(eDaysOfService.Friday); train.FollowUpServices.Add(relation); var bll = new CalculationBLL(); var result = bll.GetFollowUpService(train, estw); Assert.IsTrue(result.Succeeded); Assert.IsNull(result.Result); }
public TimeTableViewModel(Dispatcher Dispatcher, Station Station) : base() { this.Dispatcher = Dispatcher; CurrentStation = Station; Schedules = new ObservableCollection <TimeTableItemViewModel>(); m_CalculationBll = new CalculationBLL(); m_DoubleClickCommand = new CommandHandler(__RowDoubleClick, true); }
public HomeController() { string log = ConfigurationManager.AppSettings["ErrorLogPath"]; string connectionString = ConfigurationManager.ConnectionStrings["DataSource"].ConnectionString; _Logger = new Logger(log); calc = new CalculationBLL(); game = new GameDAO(connectionString, log); _GameOrderDataAccess = new GameOrderDAO(connectionString, log); }
private static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e) { try { CalculationBLL.Run(); } catch (Exception ex) { ErrorLog.Log("Calculation", ex.ToString()); } }
public TrainScheduleViewModel(Dispatcher Dispatcher, Train Train, Area Area) : base() { this.Dispatcher = Dispatcher; CurrentTrain = Train; m_CalculationBll = new CalculationBLL(); m_SettingsBll = new SettingsBLL(); Stations = new ObservableCollection <TrainScheduleStationViewModel>(); if (Area != null) { Refresh(Area); } }
public TrainProgressInformationViewModel(Dispatcher Dispatcher, Area area) { this.Dispatcher = Dispatcher; Trains = new ObservableCollection <TrainStationViewModel>(); m_SettingsBll = new SettingsBLL(); m_CalculationBll = new CalculationBLL(); m_Area = area; m_Random = new Random(); m_DoubleClickCommand = new CommandHandler(__RowDoubleClick, true); EnterExpectedDelayCommand = new CommandHandler(__EnterExpectedDelay, false); ShowTrainScheduleCommand = new CommandHandler(__ShowTrainSchedule, false); ShowTrackChangeCommand = new CommandHandler(__ShowTrackChange, false); ShowLocalOrdersCommand = new CommandHandler(__ShowLocalOrders, false); ShowTrainCompositionCommand = new CommandHandler(__ShowTrainComposition, false); ShowDelayJustificationCommand = new CommandHandler(__ShowDelayJustification, false); NewTrainStateCommand = new CommandHandler(__NewTrainState, true); EnterTrainStateCommand = new CommandHandler(__EnterTrainState, false); NewCommand = new CommandHandler(__NewEntry, true); DeleteCommand = new CommandHandler(__DeleteEntry, false); }
public void CalculationBLLTest_GetPreviousService_SimpleCase() { var estw = new ESTW("ID", "Name", string.Empty, null); var train = new Train(1); var relation = new TrainRelation(2); relation.Days.Add(eDaysOfService.Monday); relation.Days.Add(eDaysOfService.Tuesday); relation.Days.Add(eDaysOfService.Wednesday); relation.Days.Add(eDaysOfService.Thursday); relation.Days.Add(eDaysOfService.Friday); relation.Days.Add(eDaysOfService.Saturday); relation.Days.Add(eDaysOfService.Sunday); train.PreviousServices.Add(relation); var bll = new CalculationBLL(); var result = bll.GetPreviousService(train, estw); Assert.IsTrue(result.Succeeded); Assert.AreEqual(2, result.Result); }
public TrainScheduleViewModel(Dispatcher Dispatcher, Train Train, Area Area) { this.Dispatcher = Dispatcher; CurrentTrain = Train; m_Area = Area; m_LiveDataBll = new LiveDataBLL(); m_CalculationBll = new CalculationBLL(); m_SettingsBll = new SettingsBLL(); Stations = new ObservableCollection <TrainScheduleStationViewModel>(); OpenTrainScheduleCommand = new CommandHandler <int?>(__OpenTrainSchedule, true); EditCommand = new CommandHandler(__EnterEditMode, true); DelayJustificationCommand = new CommandHandler(__ShowDelayJustificationWindow, false); ShowTrainCompositionCommand = new CommandHandler(__ShowTrainComposition, Train.Composition.IsNotNullOrWhiteSpace()); CloseCommand = new CommandHandler(OnCloseWindow, true); SaveCommand = new CommandHandler(__Save, true); CancelCommand = new CommandHandler(__ExitEditMode, true); CancelTrainCommand = new CommandHandler(__CancelTrain, true); if (Area != null) { Refresh(Area); } }
public void CalculationBLLTest_GetFollowUpService_BeforeMidnight() { var estw = new ESTW("ID", "Name", string.Empty, null); estw.Time = new LeibitTime(eDaysOfService.Thursday, 23, 55); var train = new Train(0); new Schedule(train, new LeibitTime(0, 5), null, null, new List <eDaysOfService>(), eScheduleDirection.Unknown, eHandling.Destination, string.Empty); var relation = new TrainRelation(1); relation.Days.Add(eDaysOfService.Monday); train.FollowUpServices.Add(relation); relation = new TrainRelation(2); relation.Days.Add(eDaysOfService.Tuesday); train.FollowUpServices.Add(relation); relation = new TrainRelation(3); relation.Days.Add(eDaysOfService.Wednesday); train.FollowUpServices.Add(relation); relation = new TrainRelation(4); relation.Days.Add(eDaysOfService.Thursday); train.FollowUpServices.Add(relation); relation = new TrainRelation(5); relation.Days.Add(eDaysOfService.Friday); train.FollowUpServices.Add(relation); var bll = new CalculationBLL(); var result = bll.GetFollowUpService(train, estw); Assert.IsTrue(result.Succeeded); Assert.AreEqual(5, result.Result); }
public void CalculationBLLTest_GetPreviousService_BeforeMidnight() { var area = new Area("ID", "Name"); var estw = new ESTW("ID", "Name", string.Empty, area); estw.Time = new LeibitTime(eDaysOfService.Thursday, 23, 45); var train = new Train(0); var train1 = new Train(1); new Schedule(train1, new LeibitTime(0, 55), null, null, new List <eDaysOfService>(), eScheduleDirection.Unknown, eHandling.Destination, string.Empty); area.Trains.TryAdd(1, train1); var train2 = new Train(2); new Schedule(train2, new LeibitTime(0, 55), null, null, new List <eDaysOfService>(), eScheduleDirection.Unknown, eHandling.Destination, string.Empty); area.Trains.TryAdd(2, train2); var train3 = new Train(3); new Schedule(train3, new LeibitTime(0, 55), null, null, new List <eDaysOfService>(), eScheduleDirection.Unknown, eHandling.Destination, string.Empty); area.Trains.TryAdd(3, train3); var train4 = new Train(4); new Schedule(train4, new LeibitTime(0, 55), null, null, new List <eDaysOfService>(), eScheduleDirection.Unknown, eHandling.Destination, string.Empty); area.Trains.TryAdd(4, train4); var train5 = new Train(5); new Schedule(train5, new LeibitTime(0, 55), null, null, new List <eDaysOfService>(), eScheduleDirection.Unknown, eHandling.Destination, string.Empty); area.Trains.TryAdd(5, train5); var relation = new TrainRelation(1); relation.Days.Add(eDaysOfService.Monday); train.PreviousServices.Add(relation); relation = new TrainRelation(2); relation.Days.Add(eDaysOfService.Tuesday); train.PreviousServices.Add(relation); relation = new TrainRelation(3); relation.Days.Add(eDaysOfService.Wednesday); train.PreviousServices.Add(relation); relation = new TrainRelation(4); relation.Days.Add(eDaysOfService.Thursday); train.PreviousServices.Add(relation); relation = new TrainRelation(5); relation.Days.Add(eDaysOfService.Friday); train.PreviousServices.Add(relation); var bll = new CalculationBLL(); var result = bll.GetPreviousService(train, estw); Assert.IsTrue(result.Succeeded); Assert.AreEqual(5, result.Result); }
public void CalculationBLLTest_CalculateDelay_Unscheduled() { var bll = new CalculationBLL(); var estw = new ESTW("meep", "bla", string.Empty, null); var train = new Train(4711); var liveTrain = new TrainInformation(train); var station1 = new Station("Bahnhof A", "A", 1, string.Empty, string.Empty, estw); var station2 = new Station("Bahnhof B", "B", 2, string.Empty, string.Empty, estw); var station3 = new Station("Bahnhof C", "C", 3, string.Empty, string.Empty, estw); var track1 = new Track("dummy", true, true, station1, null); var track2 = new Track("dummy", true, true, station2, null); var track3 = new Track("dummy", true, true, station3, null); var schedule1 = new Schedule(train, null, new LeibitTime(8, 20), track1, new List <eDaysOfService> { eDaysOfService.Tuesday }, eScheduleDirection.LeftToRight, eHandling.Transit, string.Empty, null); var schedule2 = new Schedule(train, null, new LeibitTime(8, 30), track2, new List <eDaysOfService> { eDaysOfService.Tuesday }, eScheduleDirection.LeftToRight, eHandling.Transit, string.Empty, null); train.AddSchedule(schedule1); train.AddSchedule(schedule2); var liveSchedule1 = new LiveSchedule(liveTrain, schedule1); var liveSchedule2 = new LiveSchedule(liveTrain, schedule2); liveTrain.AddSchedule(liveSchedule1); liveTrain.AddSchedule(liveSchedule2); liveSchedule1.LiveArrival = new LeibitTime(8, 21); liveSchedule1.LiveDeparture = new LeibitTime(8, 22); estw.Time = new LeibitTime(eDaysOfService.Tuesday, 8, 25); var result = bll.CalculateDelay(liveTrain, estw); Assert.IsTrue(result.Succeeded); Assert.AreEqual(2, result.Result); liveTrain.Delay = result.Result.Value; estw.Time = new LeibitTime(eDaysOfService.Tuesday, 8, 39); var liveSchedule3 = new LiveSchedule(liveTrain, station3); liveTrain.AddSchedule(liveSchedule3); train.AddSchedule(liveSchedule3.Schedule); liveSchedule3.LiveArrival = estw.Time; liveSchedule3.LiveDeparture = estw.Time; Assert.AreEqual(new LeibitTime(eDaysOfService.Tuesday, 8, 37), liveSchedule3.Schedule.Arrival); Assert.AreEqual(new LeibitTime(eDaysOfService.Tuesday, 8, 37), liveSchedule3.Schedule.Departure); result = bll.CalculateDelay(liveTrain, estw); Assert.IsTrue(result.Succeeded); Assert.AreEqual(2, result.Result); estw.Time = new LeibitTime(eDaysOfService.Tuesday, 8, 45); liveSchedule2.LiveArrival = estw.Time; liveSchedule2.LiveDeparture = estw.Time; result = bll.CalculateDelay(liveTrain, estw); Assert.IsTrue(result.Succeeded); Assert.AreEqual(15, result.Result); }
protected DisplayViewModelBase(DisplayViewModel parent) { m_Parent = parent; m_CalculationBll = new CalculationBLL(); }