public void Is_invalid_when_item_status_is_shipped() { var item = new OrderItem(); item.OrderStatusID = OrderStatusConstants.SHIPPED_STATUS; var rule = new ValidOrderItemStatusForUpdateRule(item); rule.Validate().IsValid.ShouldBe(false); rule.ErrorMessage.ShouldBe("Shipped items cannot be changed"); }
public void Is_invalid_when_item_status_is_backordered() { var item = new OrderItem(); item.OrderStatusID = OrderStatusConstants.BACK_ORDERED_STATE; var rule = new ValidOrderItemStatusForUpdateRule(item); rule.Validate().IsValid.ShouldBe(false); rule.ErrorMessage.ShouldBe("Backordered items cannot be changed"); }
public void Is_valid_when_item_status_is_submitted() { var item = new OrderItem(); item.OrderStatusID = OrderStatusConstants.SUBMITTED_STATUS; var rule = new ValidOrderItemStatusForUpdateRule(item); rule.Validate().IsValid.ShouldBe(true); rule.ErrorMessage.ShouldBe(null); }
public async Task Is_valid_when_item_status_is_pending_async() { var item = new OrderItem(); item.OrderStatusID = OrderStatusConstants.PENDING_STATUS; var rule = new ValidOrderItemStatusForUpdateRule(item); await rule.ValidateAsync(); rule.IsValid.ShouldBe(true); rule.ErrorMessage.ShouldBe(null); }