public void Ensure_order_can_only_be_cancelled_when_orderStatus_is_not_cancelled_yet() { var order = new Order(); foreach (OrderStatus os in Enum.GetValues(typeof(OrderStatus))) { foreach (PaymentStatus ps in Enum.GetValues(typeof(PaymentStatus))) { foreach (ShippingStatus ss in Enum.GetValues(typeof(ShippingStatus))) { order.OrderStatus = os; order.PaymentStatus = ps; order.ShippingStatus = ss; if (os != OrderStatus.Cancelled) { _orderProcessingService.CanCancelOrder(order).ShouldBeTrue(); } else { _orderProcessingService.CanCancelOrder(order).ShouldBeFalse(); } } } } }
public void EnsureOrderCanOnlyBeCancelledWhenOrderStatusIsNotCanCelledYet() { var order = new Order(); foreach (OrderStatus os in Enum.GetValues(typeof(OrderStatus))) { foreach (PaymentStatus ps in Enum.GetValues(typeof(PaymentStatus))) { foreach (ShippingStatus ss in Enum.GetValues(typeof(ShippingStatus))) { order.OrderStatus = os; order.PaymentStatus = ps; order.ShippingStatus = ss; if (os != OrderStatus.Cancelled) { _orderProcessingService.CanCancelOrder(order).Should().BeTrue(); } else { _orderProcessingService.CanCancelOrder(order).Should().BeFalse(); } } } } }