public async void Address2_Update_null() { Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>(); venueRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Venue())); var validator = new ApiVenueServerRequestModelValidator(venueRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiVenueServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Address2, null as string); }
public async void Address1_Create_length() { Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>(); venueRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Venue())); var validator = new ApiVenueServerRequestModelValidator(venueRepository.Object); await validator.ValidateCreateAsync(new ApiVenueServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Address1, new string('A', 129)); }
public async void ProvinceId_Update_Invalid_Reference() { Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>(); venueRepository.Setup(x => x.ProvinceByProvinceId(It.IsAny <int>())).Returns(Task.FromResult <Province>(null)); var validator = new ApiVenueServerRequestModelValidator(venueRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiVenueServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.ProvinceId, 1); }
public async void AdminId_Create_Invalid_Reference() { Mock <IVenueRepository> venueRepository = new Mock <IVenueRepository>(); venueRepository.Setup(x => x.AdminByAdminId(It.IsAny <int>())).Returns(Task.FromResult <Admin>(null)); var validator = new ApiVenueServerRequestModelValidator(venueRepository.Object); await validator.ValidateCreateAsync(new ApiVenueServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.AdminId, 1); }