public async void CountryId_Update_Valid_Reference() { Mock <IDestinationRepository> destinationRepository = new Mock <IDestinationRepository>(); destinationRepository.Setup(x => x.CountryByCountryId(It.IsAny <int>())).Returns(Task.FromResult <Country>(new Country())); var validator = new ApiDestinationServerRequestModelValidator(destinationRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiDestinationServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.CountryId, 1); }
public async void Name_Update_null() { Mock <IDestinationRepository> destinationRepository = new Mock <IDestinationRepository>(); destinationRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Destination())); var validator = new ApiDestinationServerRequestModelValidator(destinationRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiDestinationServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, null as string); }
public async void Name_Create_length() { Mock <IDestinationRepository> destinationRepository = new Mock <IDestinationRepository>(); destinationRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Destination())); var validator = new ApiDestinationServerRequestModelValidator(destinationRepository.Object); await validator.ValidateCreateAsync(new ApiDestinationServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 129)); }