public void Order_ItemsPrice_IsCorrect_WithUnExpectedParameters() { // arrange OperationNormalPrices operationNoormalPrices = new OperationNormalPrices(); Order order = new Order(operationNoormalPrices); Items items = new Items(); items.Add(new Item() { Name = "西瓜", Price = 0.0 }); // act order.Items = items; // assert Assert.Null(order.Items); }
public void Order_ItemsCountAfterFilter_WithExpectedParameters() { // arrange int expected = 4; OperationNormalPrices operationNormalPrices = new OperationNormalPrices(); Order order = new Order(operationNormalPrices); Items items = new Items(); order.Items = items; // act int countAfterFilter = -1; order.FilteredItemsCountEvents += (obj) => { countAfterFilter = obj; }; var result = order.GetPrices(); // assert Assert.True(countAfterFilter == expected); }
public void Order_MergeOrders_ThrowException() { // arrange MergeOrders <Order> merge = new MergeOrders <Order>(); OperationNormalPrices operationNoormalPrices = new OperationNormalPrices(); VipOrder order1 = new VipOrder(operationNoormalPrices) { }; VipOrder order2 = new VipOrder(operationNoormalPrices) { }; // act IMergeOrderList <VipOrder> result = merge.MergeNormal(order1, order2); IMergeOrderList <VipOrder> result2 = merge.MergeNormal <VipOrder>(order1, order2); // assert Assert.True(result.GetType().Name == typeof(MergeOrderList <VipOrder>).Name); }
public void Order_GetPrices_WithExpectedParameters() { // arrange double expectedTotalPrice = 10935.99; OperationNormalPrices operationNormalPrices = new OperationNormalPrices(); Order order = new Order(operationNormalPrices); Items items = new Items(); items.Add(new Item() { Code = "Normal_003", Name = "西瓜", Price = 39.99 }); order.Items = items; // act order.FilteredItemsCountEvents += (obj) => { }; var result = order.GetPrices(); // assert Assert.True(result == expectedTotalPrice); }