public async Task Should_Add_ReturnsBadRequestResult() { //Arrange var model = new ResidentialToAdd(); _controller = new ResidentialController(_managerMock.Object); _controller.ValidateViewModel(model); //Act var result = await _controller.Add(model); //Assert _managerMock.Verify(x => x.AddAsync(model), Times.Never); Assert.IsType <BadRequestResult>(result); }
public async Task Should_Add_ReturnsNoContentResult() { //Arrange const string name = "Residential Name"; var model = new ResidentialToAdd { Name = name }; _controller = new ResidentialController(_managerMock.Object); _controller.ValidateViewModel(model); //Act var result = await _controller.Add(model); //Assert _managerMock.Verify(x => x.AddAsync(model), Times.Once); Assert.IsType <NoContentResult>(result); }