public async void SpeciesId_Create_Valid_Reference() { Mock <IBreedRepository> breedRepository = new Mock <IBreedRepository>(); breedRepository.Setup(x => x.SpeciesBySpeciesId(It.IsAny <int>())).Returns(Task.FromResult <Species>(new Species())); var validator = new ApiBreedServerRequestModelValidator(breedRepository.Object); await validator.ValidateCreateAsync(new ApiBreedServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.SpeciesId, 1); }
public async void Name_Create_length() { Mock <IBreedRepository> breedRepository = new Mock <IBreedRepository>(); breedRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Breed())); var validator = new ApiBreedServerRequestModelValidator(breedRepository.Object); await validator.ValidateCreateAsync(new ApiBreedServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129)); }