示例#1
0
        private async Task Date_InFuture_Invalid(KeyDatesCommand command)
        {
            var model = GetValidViewModel();

            model.NewDate = new OptionalDateInputViewModel(SystemTime.UtcNow.AddDays(1));
            model.Command = command;

            var controller = GetMockAssessmentController(model);

            await controller.Index(notificationId, model);

            Assert.True(controller.ModelState.ContainsKey("NewDate"));
        }
        public async Task<ActionResult> Index(Guid id, KeyDatesCommand? command)
        {
            var data = await mediator.SendAsync(new GetKeyDates(id));

            var model = new KeyDatesViewModel(data);

            if (command.HasValue)
            {
                model.Command = command.Value;
                AddRelevantDateToNewDate(model);
            }

            return View(model);
        }
示例#3
0
        private async Task NotBefore_PaymentReceivedDate(KeyDatesCommand command)
        {
            var model = GetValidViewModel();

            model.NotificationCompleteDate = null;
            model.NewDate = new OptionalDateInputViewModel(new DateTime(2015, 8, 1));
            model.Command = command;

            var controller = GetMockAssessmentController(model);

            await controller.Index(notificationId, model);

            Assert.True(controller.ModelState.ContainsKey("NewDate"));
        }
示例#4
0
        private async Task NotificationReceivedDate_MustBePresent(KeyDatesCommand command)
        {
            var model = GetValidViewModel();

            model.NotificationCompleteDate = null;
            model.NotificationReceivedDate = null;
            model.NewDate = new OptionalDateInputViewModel(SystemTime.UtcNow);
            model.Command = command;

            var controller = GetMockAssessmentController(model);

            await controller.Index(notificationId, model);

            Assert.True(controller.ModelState.ContainsKey("NewDate"));
        }
        private async Task Date_InFuture_Invalid(KeyDatesCommand command)
        {
            var model = GetValidViewModel();
            model.NewDate = new OptionalDateInputViewModel(SystemTime.UtcNow.AddDays(1));
            model.Command = command;

            var controller = GetMockAssessmentController(model);

            await controller.Index(notificationId, model);

            Assert.True(controller.ModelState.ContainsKey("NewDate"));
        }
        public async Task NotBefore_NotificationReceivedDate(KeyDatesCommand command)
        {
            var model = GetValidViewModel();
            model.NotificationCompleteDate = null;
            model.NewDate = new OptionalDateInputViewModel(new DateTime(2015, 7, 2));
            model.Command = command;

            var controller = GetMockAssessmentController(model);

            await controller.Index(notificationId, model);

            Assert.True(controller.ModelState.ContainsKey("NewDate"));
        }
        private async Task NotificationReceivedDate_MustBePresent(KeyDatesCommand command)
        {
            var model = GetValidViewModel();
            model.NotificationCompleteDate = null;
            model.NotificationReceivedDate = null;
            model.NewDate = new OptionalDateInputViewModel(SystemTime.UtcNow);
            model.Command = command;

            var controller = GetMockAssessmentController(model);

            await controller.Index(notificationId, model);

            Assert.True(controller.ModelState.ContainsKey("NewDate"));
        }