public GameController(RenderController renderController, InputController inputController, SaveController saveController, LevelController levelController, LevelFactory levelFactory, ItemFactory itemFactory, ScreenFactory screenFactory, PlayerFactory playerFactory, EnemyFactory enemyFactory, EventBus eventBus, ScheduleController scheduleController ) { _renderController = renderController; _inputController = inputController; _saveController = saveController; _levelController = levelController; _levelFactory = levelFactory; _itemFactory = itemFactory; _screenFactory = screenFactory; _playerFactory = playerFactory; _enemyFactory = enemyFactory; _eventBus = eventBus; _scheduleController = scheduleController; }
public ManageSchedule(ScheduleController scheduleController, IEnumerable <Employee> allEmployeeList, IEnumerable scEmployeeItems, string curDate) { this.scheduleController = scheduleController; try { this.currentDate = DateTime.Parse(curDate); } catch {} this.InitializeComponent(); foreach (object curEmployee in scEmployeeItems) { this.activeEmployeeList.Add(curEmployee as Employee); this.oldActiveEmployeeList.Add(curEmployee as Employee); this.ScActiveEmployeeGrid.Items.Add(curEmployee); } foreach (Employee curEmployee in allEmployeeList.Where(curEmployee => !this.ScActiveEmployeeGrid.Items.Contains(curEmployee))) { this.allEmployeesList.Add(curEmployee); this.ScAllEmployeeGrid.Items.Add(curEmployee); } this.ScMeDateLabel.Content = curDate; }
public void GetNextWeekDay_OneDayBefore() { var d = new DateTime(2019, 2, 4); var res = ScheduleController.GetNextWeekDay(d, DayOfWeek.Tuesday); Assert.AreEqual(5, res.Day); }
public void InitializeTest() { _mockScheduleRepository = MockRepository.GenerateMock <IScheduleRepository>(); _scheduleController = new ScheduleController(_mockScheduleRepository); _templateScheduleController = new TemplateScheduleController(); _templateShiftController = new TemplateShiftController(new TemplateShiftRepository()); }
public void StartInitialize(int id) { if (scheduleInfo == null) { scheduleInfo = CSVReader.Read("ScheduleInfo"); } //schReqWeek = (int)scheduleInfo[id]["requireWeek"]; // 아 여기선 필요 없나. ScheduleController lc = GameObject.Find("5.ScheduleCanvas").GetComponent <ScheduleController>(); b.onClick.AddListener(delegate() { lc.ListUpSchedule(scheduleID); }); int schLv = DataController.Instance.gameData.scheduleLevel[id]; scheduleTitle.text = scheduleInfo[id]["scheduleTitle"] + " Lv. " + schLv.ToString(); scheduleReqTime.text = "소모 기간 " + scheduleInfo[id]["requireWeek"].ToString() + " 주"; int reward1 = (int)scheduleInfo[id]["scheduleRewardID1"]; int reward2 = (int)scheduleInfo[id]["scheduleRewardID2"]; int reward3 = (int)scheduleInfo[id]["scheduleRewardID3"]; scheduleRewardIcon1.sprite = Resources.Load <Sprite>("Image/ParameterIcon/parameter_up_" + reward1); scheduleRewardIcon2.sprite = Resources.Load <Sprite>("Image/ParameterIcon/parameter_up_" + reward2); scheduleRewardIcon3.sprite = Resources.Load <Sprite>("Image/ParameterIcon/parameter_down_" + reward3); }
public ActionResult Index1(tblschedule c) { ScheduleController sc = new ScheduleController(Server); return((ActionResult)sc.Index1Post(Request, c)["view"]); //return null; }
public DataTable CreateTable(DateTime aDate) { //Method for getting the schedule and displaying it in a datagrid DataTable dt = new DataTable(); Schedule s = new Schedule(); ScheduleController sc = new ScheduleController(); UserController uc = new UserController(); RoleController rc = new RoleController(); //Get the schedule by the specific date s = sc.getScheduleByDate(aDate); //Create the columns for the schedule dt.Columns.Add("Employee", typeof(string)); dt.Columns.Add("Shift", typeof(string)); dt.Columns.Add("Role", typeof(string)); List <Role> roles = rc.getAllRoles(); List <User> users = uc.getAllUsersWithoutRoles(); //Iterate through the UserRoles table and get all the schedule data for (int i = 0; i < s.UserRoles.Count; i++) { try { User u = (User)users.Where(uu => uu.Id == s.UserRoles.ElementAt(i).Key).ElementAt(0); Role r = (Role)roles.Where(rr => rr.Id == s.UserRoles.ElementAt(i).Value).ElementAt(0); dt.Rows.Add(u.UserName, u.Shift, r.RoleName); } catch { } } return(dt); }
public void TestScheduleController() { var log = new LoggingManager("/dev/null"); var controller = new ScheduleController(1, log); controller.SetSchedule(new[] { new ScheduleEntry { StationId = 1, MinimumBoardingTime = TimeSpan.FromMinutes(2), ArrivalTime = new DateTime(2020, 09, 12, 12, 00, 00), DepartureTime = new DateTime(2020, 09, 12, 12, 02, 00) }, new ScheduleEntry { StationId = 2, MinimumBoardingTime = TimeSpan.FromMinutes(2), ArrivalTime = new DateTime(2020, 09, 12, 12, 10, 00), DepartureTime = new DateTime(2020, 09, 12, 12, 12, 00) }, }); var cmd = controller.Update(new DateTime(2020, 09, 12, 12, 00, 00), ScheduleController.Mode.FOLLOW_SCHEDULE, new WaypointControllerStatus { State = WaypointController.State.STOPPED }); Assert.NotNull(cmd); Assert.Equal(WaypointController.Mode.GOTO_STATION, cmd.Value.mode); Assert.Equal(1, cmd.Value.gotoStationId); }
public void Setup() { _crewConfigurationMock = new Mock <IDataConfiguration>(); _dummyDatabaseRepository = new Mock <IDatabaseRepository>(); _scheduleController = new ScheduleController(_dummyDatabaseRepository.Object); }
public void Edit_ShouldReturnCorrectJsonWhenModelInvalid() { var mapperStub = new Mock <IMapper>(); var weekScheduleServiceStub = new Mock <IWeekScheduleService>(); var workoutInformationServiceStub = new Mock <IWorkoutInformationService>(); var modelViewFactoryStub = new Mock <IModelViewFactory>(); var dailyWorkoutServiceStub = new Mock <IDailyWorkoutService>(); var sut = new ScheduleController(mapperStub.Object, weekScheduleServiceStub.Object, workoutInformationServiceStub.Object, dailyWorkoutServiceStub.Object, modelViewFactoryStub.Object); var dailyWorkout = new DailyWorkoutViewModel(); dailyWorkout.Name = "awesomeness"; dailyWorkout.ScheduleId = new Guid(); var wodInfo = new WorkoutInformation(); var wodDataModel = new DailyWorkout(); var schedule = new WeekSchedule(); workoutInformationServiceStub.Setup(x => x.GetByName(It.IsAny <string>())).Returns(wodInfo); mapperStub.Setup(x => x.Map <DailyWorkout>(It.IsAny <DailyWorkoutViewModel>())).Returns(wodDataModel); dailyWorkoutServiceStub.Setup(x => x.AddAllDailyWorkouts(It.IsAny <DailyWorkout>(), It.IsAny <DailyWorkout>(), It.IsAny <DailyWorkout>())); weekScheduleServiceStub.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(schedule); weekScheduleServiceStub.Setup(x => x.AddDailiesToSchedule(It.IsAny <WeekSchedule>(), It.IsAny <DailyWorkout>(), It.IsAny <DailyWorkout>(), It.IsAny <DailyWorkout>())); sut .WithModelErrors() .WithCallTo(c => c.Edit(dailyWorkout)) .ShouldReturnJson(); }
public void All_ShouldRenderDefaultViewWithCorrectModel() { var mapperStub = new Mock <IMapper>(); var weekScheduleServiceStub = new Mock <IWeekScheduleService>(); var workoutInformationServiceStub = new Mock <IWorkoutInformationService>(); var modelViewFactoryStub = new Mock <IModelViewFactory>(); var dailyWorkoutServiceStub = new Mock <IDailyWorkoutService>(); var sut = new ScheduleController(mapperStub.Object, weekScheduleServiceStub.Object, workoutInformationServiceStub.Object, dailyWorkoutServiceStub.Object, modelViewFactoryStub.Object); var allSchedules = new List <WeekSchedule>() { new WeekSchedule() }; var scheduleViewModel = new ScheduleViewModel(); var allSchedulesViewModel = new AllSchedulesViewModel(); weekScheduleServiceStub.Setup(x => x.GetAllDescending()).Returns(allSchedules); mapperStub.Setup(x => x.Map <ScheduleViewModel>(It.IsAny <WeekSchedule>())).Returns(scheduleViewModel); modelViewFactoryStub.Setup(x => x.CreateAllSchedulesViewModel(It.IsAny <List <ScheduleViewModel> >())).Returns(allSchedulesViewModel); sut .WithCallTo(c => c.All()) .ShouldRenderDefaultView() .WithModel(allSchedulesViewModel); }
public ScheduleControllerTest() { _logger = new Mock <ILogger <Schedule> >(); _service = new Mock <IScheduleService>(); _nodeService = new Mock <INodeServices>(); _controller = new ScheduleController(_logger.Object, _service.Object); }
private void OpenPageIfNeeded() { if (!App.MainSession.Initialized) { /* Device.BeginInvokeOnMainThread(() => * { * var page = new IntroPage(App.MainSession.GetAllWashingDays(), App.BL, mAlarmController); * page.PageClosed += IntroPage_Closed; * Navigation.PushAsync(page, true); * }); * return;*/ } if (!String.IsNullOrEmpty(App.washdayToShow)) { var day = App.MainSession.GetWashingDayById(App.washdayToShow); var contr = new WashingDayEditorController(day, App.MainSession.GetAllDefinitions(), mAlarmController); var wdInstance = contr.GetWashingDayInstance(ScheduleController.GetToday()); App.washdayToShow = String.Empty; Device.BeginInvokeOnMainThread(() => { Navigation.PushAsync(new WashDayInstance(day, wdInstance, mHairBl), true); }); ; } Device.BeginInvokeOnMainThread(() => { //var helpController = new Controller.HelpController(); //helpController.Add("Foo", "Des", "Tooltip", mAddCareDayButton); //var diaog = new HelpPage(helpController); // Open a PopupPage //Navigation.PushPopupAsync(diaog); }); }
public CollectService() { var diContainer = new UnityContainer().CreateChildContainer(); lock (ScheduleInitLock) { var scheduler = new Quartz.Impl.StdSchedulerFactory().GetScheduler(); if (ScheduleController == null) { SchedulerContainer = diContainer.CreateChildContainer(); scheduler.JobFactory = new UnityJobFactory(SchedulerContainer); ScheduleController = new ScheduleController(scheduler); ScheduleController.ReschedulingAlreadyExecuted = false; } diContainer.RegisterType <IDataProvider, DataProvider>(new ContainerControlledLifetimeManager()); diContainer.RegisterType <ICollectRequestRepository, CollectRequestRepository>(new ContainerControlledLifetimeManager()); diContainer.RegisterType <IProbeManager, ProbeManager>(); diContainer.RegisterType <ICollectRequestAssembler, CollectRequestAssembler>(new ContainerControlledLifetimeManager()); diContainer.RegisterType <ICollectPackageAssembler, CollectPackageAssembler>(new ContainerControlledLifetimeManager()); diContainer.RegisterType <ICollectResultAssembler, CollectResultAssembler>(new ContainerControlledLifetimeManager()); diContainer.RegisterType <IDefinitionDocumentFactory, DefinitionDocumentFactory>(new ContainerControlledLifetimeManager()); diContainer.RegisterInstance <IScheduler>(scheduler); diContainer.RegisterInstance <IScheduleController>(ScheduleController); CollectController = diContainer.Resolve <CollectController>(); } }
public void Should_be_possible_to_reschedule_the_collectRequest_that_was_not_collect() { var fakeSession = DataProvider.GetSession(); var package1 = new CollectRequestFactory().CreateCollectRequest(fakeSession); var collectRequest = package1.Item2; this.SaveCollectRequest(collectRequest); var package2 = new CollectRequestFactory().CreateCollectRequest(fakeSession); var otherCollectRequest = package2.Item2; this.SaveCollectRequest(otherCollectRequest); package1.Item1.ScheduleInformation.ExecutionDate.AddSeconds(100); package2.Item1.ScheduleInformation.ExecutionDate.AddSeconds(100); var fakeRepository = new CollectRequestRepository(DataProvider); var scheduler = new StdSchedulerFactory().GetScheduler(); var scheduleController = new ScheduleController(scheduler); scheduleController.TypeOfExecutionJob = typeof(TestJob); scheduleController.ReScheduleCollectRequests( fakeSession, new[] { collectRequest, otherCollectRequest }, fakeRepository); Assert.AreEqual(2, scheduleController.GetNumberOfCollectRequestScheduled(), "the number of collectRequest schedule is not expected"); scheduler.Shutdown(); }
public void GetSchedules_Returns_Empty_NonExistingUser() { //Arrange IQueryable <Schedule> fakeSchedules = GetSchedules(); _scheduleRepositoryMock.Setup(x => x.Schedules).Returns(fakeSchedules); var identity = new GenericIdentity("LoggedUser4"); Thread.CurrentPrincipal = new GenericPrincipal(identity, null); ScheduleController controller = new ScheduleController(_scheduleRepositoryMock.Object) { Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } } }; //Act var schedules = controller.GetSchedules(); //Assert Assert.IsNotNull(schedules, "Result is null"); Assert.IsInstanceOf(typeof(IEnumerable <ScheduleDto>), schedules, "Wrong Model"); Assert.AreEqual(0, schedules.Count(), "Got wrong number of Schedules"); }
public ActionResult Delete(FormCollection _form) { ScheduleController sc = new ScheduleController(Server); return((ActionResult)sc.Delete(Request)["view"]); //return null; }
public void GetSchedule_Returns_One_ScheduleById() { //Arrange IQueryable <Schedule> fakeSchedules = GetSchedules(); _scheduleRepositoryMock.Setup(x => x.GetById(It.IsAny <int>())).Returns(fakeSchedules.First(s => s.Id == 1)); var identity = new GenericIdentity("LoggedUser1"); Thread.CurrentPrincipal = new GenericPrincipal(identity, null); ScheduleController controller = new ScheduleController(_scheduleRepositoryMock.Object) { Request = new HttpRequestMessage() { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } } }; //Act var schedule = controller.GetSchedule(1); //Assert Assert.IsNotNull(schedule, "Result is null"); Assert.IsInstanceOf(typeof(ScheduleDto), schedule, "Wrong Type"); Assert.AreEqual(1, schedule.ScheduleId, "Got wrong schedule. Wrong Id."); Assert.AreEqual("Test1", schedule.Title, "Got wrong schedule. Wrong Title."); }
public ScheduleItems(ScheduleController controller) : base() { _controller = controller; _schedule = _controller.Schedule; _schedule.Items.ForEach((item) => Add(item)); }
public void CreateClassInstanceTest() { ScheduleController sc = new ScheduleController(); CollectionAssert.AreEqual(new List <Shift> { }, sc.GetWeeklySchedule()); }
public IController CreateController(ControllersFormat cont) { switch (cont) { case ControllersFormat.Exam: return(ExamController.getInstance(DbName, Login, Password)); case ControllersFormat.Teacher: return(TeacherController.getInstance(DbName, Login, Password)); case ControllersFormat.Student: return(StudentController.getInstance(DbName, Login, Password)); case ControllersFormat.Result: return(ResultController.getInstance(DbName, Login, Password)); case ControllersFormat.Schedule: return(ScheduleController.getInstance(DbName, Login, Password)); case ControllersFormat.Team: return(TeamController.getInstance(DbName, Login, Password)); default: throw new ArgumentException("Invalid format: " + cont.ToString()); } }
public void IndexReturnsIndex() { var controller = new ScheduleController(_usersContext, _service); var result = controller.Index() as ViewResult; Assert.IsTrue(result.ViewName == "Index"); }
public void Adding_ScheduleItem_On_Blacked_Out_Date_Should_Fail() { DateTime blackedOutDate = DateTime.Now.AddDays(3); string key = KeyHelper.GetKey <IScheduleRepository>(); var repository = RepositoryFactory.GetRepository <IScheduleRepository>(key); ScheduleController controller = new ScheduleController(); controller.CreateSchedule(TestFactories.GetDefaultLookup(), "Test Schedule", "This is a test", "test user"); Schedule schedule = repository.GetAllSchedules().Last(); controller.CreateBlackoutDate(schedule, "Test blackout date", blackedOutDate, "test user"); try { controller.CreateScheduleItem(schedule, blackedOutDate, TestFactories.GetDefaultPerson(), new List <Baptizer>(), TestFactories.GetDefaultPerson(), true, "test user"); Assert.Fail("controller.CreateScheduleItem() should throw an exception."); } catch (ValidationException ex) { Assert.IsTrue(ex.Errors[0].Contains("Unable to schedule a baptism on a Black Out Date.")); Assert.AreEqual(ex.Errors.Count, 1); } }
public override async Task Execute(Message message, TelegramBotClient botClient) { ScheduleController.Unit(); List <string> un = ScheduleController.GetUniversities(); string[][] unn = new string[un.ToList().Count][]; int count = 0; foreach (string item in un) { unn[count] = new string[] { item }; count++; } var chatId = message.Chat.Id; if (!UserController.CheckUser(chatId)) { UserController.CreateUser(chatId); } else { UserController.RecreateUser(chatId); } //await botClient.SendTextMessageAsync(chatId, "Hallo I'm ASP.NET Core Bot and I made by Mr.Robot", parseMode: Telegram.Bot.Types.Enums.ParseMode.Markdown); await botClient.SendTextMessageAsync(chatId, "Привет, выбери свой университет", parseMode : Telegram.Bot.Types.Enums.ParseMode.Markdown, replyMarkup : (Telegram.Bot.Types.ReplyMarkups.IReplyMarkup) KeybordController.GetKeyboard(unn, count)); }
private void InitCalendar() { mCalendar = new Calendar { BorderColor = Color.White, BorderWidth = 3, BackgroundColor = Color.White, StartDay = DayOfWeek.Monday, StartDate = DateTime.Now, SelectedBorderColor = Color.Black, SelectedBackgroundColor = Color.Gray, }; mCalendar.SpecialDates.Clear(); mCalendar.SelectedDate = DateTime.Now; RefreshList(ScheduleController.GetToday()); mLastDate = mCalendar.StartDate.AddDays(40); FillFutureDays(mCalendar); FillInstances(mCalendar); mCalendar.RightArrowClicked += NextMonth; mCalendar.DateClicked += Cal_DateClicked; CalendarFrame.Content = mCalendar; }
public WashingDayDefinitionHomeControl(WashingDayEditorController controller, HairAppBl.Interfaces.IHairBl hairbl) : base(controller, hairbl) { var c = new ScheduleController(controller.GetModel().Scheduled); var t = c.Time2NextCareDay(ScheduleController.GetToday()); //StartCareDay var startImage = new Image { Source = "start.png", HeightRequest = 22 }; var startCareDayTab = new TapGestureRecognizer(); startCareDayTab.Tapped += (s, e) => { StartCareDay?.Invoke(this, new WashingDayCellEventArgs(controller)); }; startImage.GestureRecognizers.Add(startCareDayTab); if (t == 0) { HeaderExtensionRight = startImage; } var text = AppResources.Today; if (t > 0) { text = AppResources.InDays.Replace("{count}", t.ToString()); } HeaderExtensionLeft = new Label { Text = text }; }
public void Monthly_LastthdFridayOfMonth() { var day = ScheduleController.GetDayFromMonthlyPeriod(DayOfWeek.Friday, ScheduleDefinition.Monthly.ScheduleType.Last, 2, 2019); Assert.AreEqual(new DateTime(2019, 2, 22), day); }
public GameController GetGameController(IOutputter outputter) { var randomiser = new Randomiser(new System.Random()); var scheduleController = new ScheduleController(); var renderController = new RenderController(outputter); var inputController = new InputController(); var saveController = new SaveController(); var levelController = new LevelController(); var levelFactory = new LevelFactory(randomiser); var itemFactory = new ItemFactory(); var stringFormatter = new StringFormatterSmartFormat(); var assetBank = new AssetBank(stringFormatter); var eventBus = new EventBus(); var eventKeeper = new EventKeeper(eventBus, assetBank); var screenFactory = new ScreenFactory(eventKeeper); var playerFactory = new PlayerFactory(levelController, eventBus, randomiser, scheduleController); var enemyFactory = new EnemyFactory(eventBus, randomiser, scheduleController); return(new GameController( renderController, inputController, saveController, levelController, levelFactory, itemFactory, screenFactory, playerFactory, enemyFactory, eventBus, scheduleController )); }
public void GetNextWeekDay_CurrentDay() { var d = new DateTime(2019, 2, 4); var res = ScheduleController.GetNextWeekDay(d, DayOfWeek.Monday); Assert.AreEqual(4, res.Day); }
public void GetSchedulesByDateForCurrentWeek_ReturnsListOfClassesWithDatesInsideTheCurrentWeek() { //arrange var searchDateDayOfWeek = (int)DateTime.Now.DayOfWeek; var beginningSearchDateOfWeek = DateTime.Now.Date.AddDays(-searchDateDayOfWeek); var endSearchDateOfWeek = beginningSearchDateOfWeek.AddDays(7); var expected = _scheduleDetailList.Where( x => x.ClassDate >= beginningSearchDateOfWeek && x.ClassDate < endSearchDateOfWeek); var todaysDate = DateTime.Now.Date; var mockScheduleService = Mock.Create <IScheduleService>(); Mock.Arrange(() => mockScheduleService.GetDetailedSchedulesForWeek(todaysDate)).Returns(_scheduleDetailList).OccursOnce(); var scheduleController = new ScheduleController(mockScheduleService); //act var actual = scheduleController.GetDetailedSchedulesForWeek(todaysDate) as OkNegotiatedContentResult <List <ScheduleDetailDto> >; var actualContent = actual.Content; //assert Mock.Assert(mockScheduleService); Assert.That(actual, Is.Not.Null); Assert.That(actualContent, Is.Not.Null); Assert.That(actualContent, Is.EqualTo(expected)); }