private KeyDatesController GetMockAssessmentController(object viewModel) { var assessmentController = new KeyDatesController(mediator, authorizationService); // Mimic the behaviour of the model binder which is responsible for Validating the Model var validationContext = new ValidationContext(viewModel, null, null); var validationResults = new List <ValidationResult>(); Validator.TryValidateObject(viewModel, validationContext, validationResults, true); foreach (var validationResult in validationResults) { assessmentController.ModelState.AddModelError(validationResult.MemberNames.First(), validationResult.ErrorMessage); } return(assessmentController); }
public KeyDatesControllerTests() { mediator = A.Fake <IMediator>(); A.CallTo( () => mediator.SendAsync(A <GetKeyDates> .That.Matches(p => p.ImportNotificationId == notificationId))) .Returns(new KeyDatesData { NotificationReceived = notificationReceivedDate, PaymentReceived = paymentReceivedDate, AcknowlegedDate = acknowledgedDate, DecisionRequiredByDate = decisionRequiredDate }); controller = new KeyDatesController(mediator); }
public KeyDatesControllerTests() { mediator = A.Fake<IMediator>(); A.CallTo( () => mediator.SendAsync(A<GetKeyDates>.That.Matches(p => p.ImportNotificationId == notificationId))) .Returns(new KeyDatesData { NotificationReceived = notificationReceivedDate, PaymentReceived = paymentReceivedDate, AcknowlegedDate = acknowledgedDate, DecisionRequiredByDate = decisionRequiredDate }); controller = new KeyDatesController(mediator); }
public KeyDatesControllerTests() { mediator = A.Fake <IMediator>(); authorizationService = A.Fake <AuthorizationService>(); A.CallTo( () => mediator.SendAsync(A <GetKeyDatesSummaryInformation> .That.Matches(p => p.NotificationId == notificationId))) .Returns(new KeyDatesSummaryData { Dates = new NotificationDatesData { NotificationId = notificationId, NotificationReceivedDate = notificationReceivedDate, PaymentReceivedDate = paymentReceivedDate, AcknowledgedDate = acknowledgedDate, DecisionRequiredDate = decisionRequiredDate } }); controller = new KeyDatesController(mediator, authorizationService); }
public KeyDatesControllerTests() { mediator = A.Fake<IMediator>(); authorizationService = A.Fake<AuthorizationService>(); A.CallTo( () => mediator.SendAsync(A<GetKeyDatesSummaryInformation>.That.Matches(p => p.NotificationId == notificationId))) .Returns(new KeyDatesSummaryData { Dates = new NotificationDatesData { NotificationId = notificationId, NotificationReceivedDate = notificationReceivedDate, PaymentReceivedDate = paymentReceivedDate, AcknowledgedDate = acknowledgedDate, DecisionRequiredDate = decisionRequiredDate } }); controller = new KeyDatesController(mediator, authorizationService); }
private KeyDatesController GetMockAssessmentController(object viewModel) { var assessmentController = new KeyDatesController(mediator); // Mimic the behaviour of the model binder which is responsible for Validating the Model var validationContext = new ValidationContext(viewModel, null, null); var validationResults = new List<ValidationResult>(); Validator.TryValidateObject(viewModel, validationContext, validationResults, true); foreach (var validationResult in validationResults) { assessmentController.ModelState.AddModelError(validationResult.MemberNames.First(), validationResult.ErrorMessage); } return assessmentController; }