Exemple #1
0
        public async void Update_ReturnsBadRequest_OnInvalidModel()
        {
            // Arrange
            var resServiceMock       = new Mock <IResourcesService>();
            var bookServiceMock      = new Mock <IBookingsService>();
            var mappServiceMock      = new Mock <IMapperService>();
            var subjectResController = new ResourcesController(resServiceMock.Object, bookServiceMock.Object, mappServiceMock.Object);

            subjectResController.ModelState.AddModelError("blah", "blah");

            // Act
            var actionResult = await subjectResController.Update(It.IsAny <int>(), It.IsAny <ResourceDetailedDto>());

            //Assert
            Assert.IsType <BadRequestObjectResult>(actionResult);
            resServiceMock.Verify(mock => mock.Update(It.IsAny <Resource>()), Times.Never());
        }