public async void TicketStatusId_Create_Valid_Reference() { Mock <ITicketRepository> ticketRepository = new Mock <ITicketRepository>(); ticketRepository.Setup(x => x.TicketStatusByTicketStatusId(It.IsAny <int>())).Returns(Task.FromResult <TicketStatus>(new TicketStatus())); var validator = new ApiTicketServerRequestModelValidator(ticketRepository.Object); await validator.ValidateCreateAsync(new ApiTicketServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.TicketStatusId, 1); }
public async void PublicId_Create_length() { Mock <ITicketRepository> ticketRepository = new Mock <ITicketRepository>(); ticketRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Ticket())); var validator = new ApiTicketServerRequestModelValidator(ticketRepository.Object); await validator.ValidateCreateAsync(new ApiTicketServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.PublicId, new string('A', 9)); }