コード例 #1
0
        public async Task GetOrder_NonExistentOrder_ReturnsNull()
        {
            var orderDataManager = new InMemoryOrderDataManager();
            var getOrderResult   = await orderDataManager.GetOrderAsync("test");

            getOrderResult.Should().BeNull();
        }
コード例 #2
0
        public async Task CreateOrder_NewOrderCreated_ReturnsNewOrder()
        {
            var orderDataManager = new InMemoryOrderDataManager();
            var order            = await orderDataManager.CreateOrderAsync();

            order.Should().NotBeNull().And.BeOfType <Order>();
        }
コード例 #3
0
        public async Task GetOrder_ExistingOrder_ReturnsExistingOrder()
        {
            var orderDataManager = new InMemoryOrderDataManager();
            var order            = await orderDataManager.CreateOrderAsync();

            var getOrderResult = await orderDataManager.GetOrderAsync(order.Id);

            getOrderResult.Should().BeEquivalentTo(order);
        }
コード例 #4
0
        public async Task GetOrder_ExistingOrderIsDeleted_ReturnsNull()
        {
            var orderDataManager = new InMemoryOrderDataManager();
            var order            = await orderDataManager.CreateOrderAsync();

            await orderDataManager.DeleteOrderAync(order.Id);

            var getOrderResult = await orderDataManager.GetOrderAsync(order.Id);

            getOrderResult.Should().BeNull();
        }
コード例 #5
0
        public async Task UpdateOrder_ExistingOrderIsUpdated_ReturnsUpdatedOrder()
        {
            var orderDataManager = new InMemoryOrderDataManager();
            var order            = await orderDataManager.CreateOrderAsync();

            order.Items.Add("test", new Item {
                Name = "teddy bear"
            });

            var updateOrderResult = await orderDataManager.UpdateOrderAsync(order);

            updateOrderResult.Should().BeEquivalentTo(order);
        }