public void ShouldReturnValidationErrorForClimate() { var planet = StarWarsMockCore.GetPlanetFail(); var resultMapped = _mapper.Map <Planet>(planet); _planetValidator.ShouldHaveValidationErrorFor(e => e.Climate, resultMapped.Climate); }
public void ShoulReturnErrorForNoId() { var planet = StarWarsMockCore.GetPlanetFail(); var resultMapped = _mapper.Map <Planet>(planet); _planetValidator.ShouldHaveValidationErrorFor(e => e.Id, resultMapped.Id); }
public void ShouldReturnNoValidationErrorForTerrain() { var planet = StarWarsMockCore.GetPlanetOK(); var resultMapped = _mapper.Map <Planet>(planet); _planetValidator.ShouldNotHaveValidationErrorFor(e => e.Terrain, resultMapped.Terrain); }
public void ShoudReturnNoErrorForAutoMapperDomainToViewModel() { var planet = StarWarsMockCore.GetPlanetDomain(); var resultMapped = _mapper.Map <PlanetViewModel>(planet); var type = resultMapped.GetType(); Assert.True(type.Equals(typeof(PlanetViewModel))); }
public async Task ShoudReturn4Planets() { //Arrange var mockRepo = new Mock <IPlanetApplicationService>(); mockRepo.Setup(repo => repo.GetAllPlanets()).ReturnsAsync(StarWarsMockCore.GetAllPlanets()); var controller = new PlanetsController(mockRepo.Object, _mapper); //Act var result = await controller.Get(); //Assert var objectResult = Assert.IsType <ObjectResult>(result); var model = Assert.IsAssignableFrom <List <PlanetViewModel> >(objectResult.Value); Assert.Equal(4, model.Count()); }