public async Task GetAllOrdersAcceptedByUser_WhenCalled_ShouldReturnCountOfOrdersAcceptedByGivenUser(Guid userGuid2, Guid userGuid3) { var sut = new GetAllOrdersAcceptedByUserQueryHandler(_context); var orders = new List <Domain.Entities.Order>() { new Domain.Entities.Order { AcceptedByUserId = AcceptedByUserIdToTest }, new Domain.Entities.Order { AcceptedByUserId = userGuid2 }, new Domain.Entities.Order { AcceptedByUserId = userGuid3 } }; _context.Order.AddRange(orders); _context.SaveChanges(); var acceptedOrdersInDb = _context.Order.Count(x => x.AcceptedByUserId == AcceptedByUserIdToTest); var result = await sut.Handle(new GetAllOrdersAcceptedByUserQuery() { UserId = AcceptedByUserIdToTest }, CancellationToken.None); var resultCount = result.Orders.Count(); resultCount.ShouldBe(acceptedOrdersInDb); }
public async Task GetAllOrdersAcceptedByUser_WhenCalled_ShouldReturnOrderAcceptedByUserListViewModel() { var sut = new GetAllOrdersAcceptedByUserQueryHandler(_context); var result = await sut.Handle(new GetAllOrdersAcceptedByUserQuery(), CancellationToken.None); result.ShouldBeOfType <OrderAcceptedByUserListViewModel>(); }