public async Task GetCustomersTest() { var sut = new GetCustomersListQueryHandler(_context, _mapper); var result = await sut.Handle(new GetCustomersListQuery(), CancellationToken.None); result.ShouldBeOfType <CustomersListVm>(); result.Customers.Count.ShouldBe(3); }
public async Task ItShouldGetCustomerList() { var customers = new List <Customer> { new Customer { CustomerId = 1, CustomerName = "first last" }, new Customer { CustomerId = 2, CustomerName = "test test" }, }; var context = new Mock <ICustomerRepository>(); context.Setup(_ => _.GetCustomers()).ReturnsAsync(customers); var sut = new GetCustomersListQueryHandler(context.Object); var result = await sut.Handle(new GetCustomersListQuery(), CancellationToken.None); result.ShouldBeOfType <GetCustomersListQueryViewModel>(); result.Customers.ShouldBe(customers); }