public async void TicketId_Create_Valid_Reference() { Mock <ISaleTicketsRepository> saleTicketsRepository = new Mock <ISaleTicketsRepository>(); saleTicketsRepository.Setup(x => x.GetTicket(It.IsAny <int>())).Returns(Task.FromResult <Ticket>(new Ticket())); var validator = new ApiSaleTicketsRequestModelValidator(saleTicketsRepository.Object); await validator.ValidateCreateAsync(new ApiSaleTicketsRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.TicketId, 1); }
public async void SaleId_Update_Valid_Reference() { Mock <ISaleTicketsRepository> saleTicketsRepository = new Mock <ISaleTicketsRepository>(); saleTicketsRepository.Setup(x => x.GetSale(It.IsAny <int>())).Returns(Task.FromResult <Sale>(new Sale())); var validator = new ApiSaleTicketsRequestModelValidator(saleTicketsRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiSaleTicketsRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.SaleId, 1); }