public async void Website_Update_length() { Mock <IEventRepository> eventRepository = new Mock <IEventRepository>(); eventRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Event())); var validator = new ApiEventServerRequestModelValidator(eventRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiEventServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Website, new string('A', 129)); }
public async void Address2_Update_null() { Mock <IEventRepository> eventRepository = new Mock <IEventRepository>(); eventRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Event())); var validator = new ApiEventServerRequestModelValidator(eventRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiEventServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Address2, null as string); }
public async void CityId_Update_Valid_Reference() { Mock <IEventRepository> eventRepository = new Mock <IEventRepository>(); eventRepository.Setup(x => x.CityByCityId(It.IsAny <int>())).Returns(Task.FromResult <City>(new City())); var validator = new ApiEventServerRequestModelValidator(eventRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiEventServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.CityId, 1); }