public async void GetOrderHandlerFailure() { var mockOrder = new MockOrderData(); var createOrderOne = mockOrder.CreateOrder(); var createOrderTwo = mockOrder.CreateOrder(); GetOrderQuery getOrderQuery = new GetOrderQuery(createOrderOne.OrderId); GetOrderHandler getOrderHandler = new GetOrderHandler(); var actual = await getOrderHandler.Handle(getOrderQuery, new CancellationToken()); Assert.NotEqual(createOrderTwo.OrderId, actual.OrderId); }
public async void GetAllOrdersHandlerFailure() { var mockOrder = new MockOrderData(); mockOrder.CreateOrder(); mockOrder.CreateOrder(); GetAllOrderQuery getAllOrderQuery = new GetAllOrderQuery(); GetAllOrderHandler getAllOrderHandler = new GetAllOrderHandler(); var actual = await getAllOrderHandler.Handle(getAllOrderQuery, new CancellationToken()); Assert.NotEqual(1, actual.Count()); }
public async void GetAllOrdersHandlerSuccess() { var mockOrder = new MockOrderData(); mockOrder.CreateOrder(); mockOrder.CreateOrder(); GetAllOrderQuery getAllOrderQuery = new GetAllOrderQuery(); GetAllOrderHandler getAllOrderHandler = new GetAllOrderHandler(); var actualHandle = await getAllOrderHandler.Handle(getAllOrderQuery, new CancellationToken()); var actual = actualHandle.Select(x => x.OrderId).Count(); var orderList = OrdersInMemory.GetInstance(); var expected = orderList.OrderList.Count(); Assert.Equal(expected, actual); }
public void CompleteOrderHandlerFailure() { var mockOrder = new MockOrderData(); var changeStatus = mockOrder.CreateOrder(); var actual = changeStatus.Status = Data.Models.OrderStatus.Done; var expected = Data.Models.OrderStatus.InProgress; Assert.NotEqual(expected, actual); }
public void CompleteOrderHandlerSuccess() { var mockOrder = new MockOrderData(); var changeStatus = mockOrder.CreateOrder(); var actual = changeStatus.Status = Data.Models.OrderStatus.Done; var expected = Data.Models.OrderStatus.Done; Assert.Equal(expected, actual); }
public async void GetOrderHandlerSuccess() { var mockOrder = new MockOrderData(); var createOrder = mockOrder.CreateOrder(); GetOrderQuery getOrderQuery = new GetOrderQuery(createOrder.OrderId); GetOrderHandler getOrderHandler = new GetOrderHandler(); var actual = await getOrderHandler.Handle(getOrderQuery, new CancellationToken()); Assert.Equal(createOrder.OrderId, actual.OrderId); }
public async void RemoveOrderHandlerFailure() { var mockOrder = new MockOrderData(); var createOrder = mockOrder.CreateOrder(); RemoveOrderCommand removeOrderCommand = new RemoveOrderCommand(createOrder.OrderId); RemoveOrderHandler removeOrderHandler = new RemoveOrderHandler(); var actual = await removeOrderHandler.Handle(removeOrderCommand, new CancellationToken()); var actualbool = actual.Error; var expectedbool = true; Assert.NotEqual(expectedbool, actualbool); }
public async void GetInProgressOrderHandlerFailure() { var mockOrder = new MockOrderData(); var createOrder = mockOrder.CreateOrder(); GetInProgressOrdersQuery getInProgressOrdersQuery = new GetInProgressOrdersQuery(); GetInProgressOrdersHandler getInProgressOrdersHandler = new GetInProgressOrdersHandler(); var actual = await getInProgressOrdersHandler.Handle(getInProgressOrdersQuery, new CancellationToken()); var actualInProgress = actual.Where(x => x.Status == OrderStatus.InProgress).Count(); var orders = OrdersInMemory.GetInstance(); var expected = orders.OrderList.Where(x => x.Status == OrderStatus.InProgress).Count() + 1; Assert.NotEqual(expected, actualInProgress); }
public async void AddItemToOrderHandlerSuccess() { AddItemToOrderHandler addItemToOrderHandler = new AddItemToOrderHandler(); var ordersInMemory = OrdersInMemory.GetInstance(); var mockOrder = new MockOrderData(); var request = mockOrder.CreateOrder(); var order = ordersInMemory.OrderList.Where(x => x.OrderId == request.OrderId).FirstOrDefault(); AddItemToOrderCommand addItemToOrderCommand = new AddItemToOrderCommand(request.OrderId, 3); var actual = await addItemToOrderHandler.Handle(addItemToOrderCommand, new CancellationToken()); var actualName = actual.Items.Select(x => x.MenuItemId).FirstOrDefault(); var expected = 3; Assert.Equal(expected, actualName); }