public void When_cancel_order_order_should_be_in_cancelled_state() { // Given var posOrder = new POSOrder(); //When posOrder.Cancel(); //Then Assert.Equal(OrderState.Cancelled, posOrder.State); Assert.True(posOrder.HasEnded); Assert.False(posOrder.PaidOut); }
public void When_try_add_item_to_cancelled_item_shouldnt_update_object() { //Given var product = new ProductSeed().GetSeedObject(); product.Id = 1; product.UpdateStock(3, product); var posOrder = new POSOrder(); var repository = MockRepository((mock) => mock.Setup(m => m.GetBy(It.IsAny <int>())) .Returns(product)); var expectedQuantity = 1; posOrder.AddItem(product.Id, expectedQuantity, repository); posOrder.Cancel(); //When posOrder.AddItem(product.Id, 1, repository); //Then var item = posOrder.Items.FirstOrDefault(); Assert.Equal(expectedQuantity, item.Quantity); }