public async void HandlerId_Create_Valid_Reference() { Mock <IAirTransportRepository> airTransportRepository = new Mock <IAirTransportRepository>(); airTransportRepository.Setup(x => x.HandlerByHandlerId(It.IsAny <int>())).Returns(Task.FromResult <Handler>(new Handler())); var validator = new ApiAirTransportServerRequestModelValidator(airTransportRepository.Object); await validator.ValidateCreateAsync(new ApiAirTransportServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.HandlerId, 1); }
public async void FlightNumber_Update_length() { Mock <IAirTransportRepository> airTransportRepository = new Mock <IAirTransportRepository>(); airTransportRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new AirTransport())); var validator = new ApiAirTransportServerRequestModelValidator(airTransportRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiAirTransportServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.FlightNumber, new string('A', 13)); }