Exemplo n.º 1
0
        public void Delete_existing_order()
        {
            ComputersController computersController = new ComputersController();
            string      macBookId   = computersController.FindComputerByName("MacBook Pro 15").Id;
            string      imacId      = computersController.FindComputerByName("iMac 27").Id;
            NewOrderDto newOrderDto = new NewOrderDto
            {
                OrderLines = new List <NewOrderLineDto>
                {
                    new NewOrderLineDto {
                        ComputerId = macBookId, Quantity = 2
                    },
                    new NewOrderLineDto {
                        ComputerId = imacId, Quantity = 2
                    }
                }
            };
            OrdersController ordersController = new OrdersController("emilybeck", "password1");
            NewOrderIdDto    orderIdDto       = ordersController.CreateNewOrder(newOrderDto);

            Assert.IsTrue(ordersController.All().Exists(order => order.OrderId.Equals(orderIdDto.Id)));

            _managementController.DeleteOrder(orderIdDto.Id);

            List <OrderInformationDto> allOrders = ordersController.All();

            Assert.IsFalse(allOrders.Exists(order => order.OrderId.Equals(orderIdDto.Id)));
        }