示例#1
0
        public async Task ShouldListOrders()
        {
            // Arrange
            var listOrdersCommand = new ListOrdersCommand(1);

            // Act
            var result = await _listOrdersQueryHandler.Handle(listOrdersCommand);

            // Assert
            Assert.IsNotNull(result?.Object);
        }
        public async void Returns_List_With_Orders_Successfully()
        {
            //Arrange
            var queryOrdersList = new ListOrdersQuery("allOrders", "true", "false", "name", "", 1, 5);

            Mediator.Setup(x => x.Send(It.IsAny <ListOrdersQuery>(), new CancellationToken()))
            .ReturnsAsync((new List <Order>(), It.IsAny <int>()));

            //Act
            var handler = new ListOrdersQueryHandler(Context);
            var result  = await handler.Handle(queryOrdersList, new CancellationToken());

            //Assert
            result.Should()
            .BeOfType <(List <Order>, int)>();

            DbContextFactory.Destroy(Context);
        }