예제 #1
0
        public async void Details_Update_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.ValidateUpdateAsync(default(int), new ApiCountryRequirementServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.Details, null as string);
        }
예제 #2
0
        public async void CountryId_Update_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.ValidateUpdateAsync(default(int), new ApiCountryRequirementServerRequestModel());

            validator.ShouldNotHaveValidationErrorFor(x => x.CountryId, 1);
        }