public async void Details_Create_null() { Mock <ICountryRequirementRepository> countryRequirementRepository = new Mock <ICountryRequirementRepository>(); countryRequirementRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new CountryRequirement())); var validator = new ApiCountryRequirementServerRequestModelValidator(countryRequirementRepository.Object); await validator.ValidateCreateAsync(new ApiCountryRequirementServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Details, null as string); }
public async void CountryId_Create_Valid_Reference() { Mock <ICountryRequirementRepository> countryRequirementRepository = new Mock <ICountryRequirementRepository>(); countryRequirementRepository.Setup(x => x.CountryByCountryId(It.IsAny <int>())).Returns(Task.FromResult <Country>(new Country())); var validator = new ApiCountryRequirementServerRequestModelValidator(countryRequirementRepository.Object); await validator.ValidateCreateAsync(new ApiCountryRequirementServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.CountryId, 1); }