Esempio n. 1
0
        public async Task CreateReturnsHttpBadRequestResultWhenModelStateHasError()
        {
            const int orgId = 1;

            var mediator = new Mock <IMediator>();

            mediator.Setup(x => x.SendAsync(It.IsAny <EventSummaryQuery>())).ReturnsAsync(new EventSummaryViewModel {
                OrganizationId = orgId
            });

            var sut = new ItineraryController(mediator.Object, MockSuccessValidation().Object);

            sut.MakeUserAnOrgAdmin(orgId.ToString());
            sut.AddModelStateError();

            var result = await sut.Create(new ItineraryEditViewModel());

            Assert.IsType <BadRequestObjectResult>(result);
        }