public void DetailsValidId() { var actual = ((ViewResult)controller.Details(1)).Model; Assert.AreEqual(cities[0], actual); }
public async Task DetailsGetAction_GetModelFromService() { // Arrange // Act var result = await validController.Details(entity.Id); // Assert mock.Verify(a => a.GetAsync(entity.Id, false)); }
public void Details_ReturnsNotEmptyView() { service.Get <CityView>(city.Id).Returns(city); Object expected = NotEmptyView(controller, city); Object actual = controller.Details(city.Id); Assert.Same(expected, actual); }
public async Task Details_Invalid_Test() { _cityService.Setup(c => c.GetByIdAsync(It.IsAny <int>())) .ReturnsAsync(() => null); _mapper.Setup(m => m.Map <CityDTO, CityViewModel>(It.IsAny <CityDTO>())) .Returns(new CityViewModel()); CitiesController citycon = CreateCityController; var result = await citycon.Details(GetFakeID()); Assert.NotNull(result); Assert.IsInstanceOf <NotFoundResult>(result); }
public async Task CityDetailsAsync() { // Arrange CitiesController controller = new CitiesController(); // Act ActionResult result = await controller.Details(1); var viewResult = (ViewResult)result; var objlist = (City)viewResult.Model; // Assert Assert.IsNotNull(result); Assert.AreEqual(1, objlist.CityId); }
public async Task Details_Valid_Test() { // Arrange _cityService .Setup(c => c.GetByIdAsync(It.IsAny <int>())) .ReturnsAsync(new CityDTO()); _mapper .Setup(m => m.Map <CityDTO, CityViewModel>(It.IsAny <CityDTO>())) .Returns(new CityViewModel()); CitiesController citycon = CreateCityController; // Act var result = await citycon.Details(GetFakeID()); // Assert Assert.NotNull(result); Assert.IsInstanceOf <OkObjectResult>(result); }