public async Task CheckProductCodeExists_InvalidValidProductCode_False() { var validateResult = await Validate.CheckProductCodeExists(MockProductCode)(ProductCodeHelper.ToProductCode("G123KC").Data); Assert.AreEqual(true, validateResult.Failure); }
public async Task CheckProductCodeExists_ValidProductCode_True() { var validateResult = await Validate.CheckProductCodeExists(MockProductCode)(ProductCodeHelper.ToProductCode("G124KC").Data); Assert.AreEqual(true, validateResult.Success); Assert.AreEqual(true, validateResult.Data); }
public void CheckQuantityValid_InvalidQuantityNumberNegativeForGizmoCode_False() { var validationResult = Validate.CheckQuantityValid( ProductCodeHelper.ToProductCode("G124KC").Data, -10m); Assert.AreEqual(true, validationResult.Failure); }
public void CheckQuantityValid_InvalidQuantityNumberGreaterThan1000ForWidgetCode_False() { var validationResult = Validate.CheckQuantityValid( ProductCodeHelper.ToProductCode("W1234DKC").Data, 10000m); Assert.AreEqual(true, validationResult.Failure); }
public async Task CheckOrderLineValid_ValidGizmoOrderLine_True() { var validationResult = await Validate.CheckOrderLineValid( Validate.CheckProductCodeExists(MockProductCode), Validate.CheckQuantityValid)( new UnvalidatedOrderLine { Amount = 100.22m, ProductCode = "G124KC" }); Assert.AreEqual(true, validationResult.Success); Assert.AreEqual(ProductCodeHelper.ToProductCode("G124KC").Data, validationResult.Data.ProductCode); Assert.AreEqual(100.22m, validationResult.Data.OrderQuantity.Value); Assert.AreEqual(1, validationResult.Data.OrderQuantity.EnumValue); Assert.AreEqual("Kilogram", validationResult.Data.OrderQuantity.DisplayName); }
public async Task CheckProductCodeExists_InvalidValidProductCode_Exception() { await Assert.ThrowsExceptionAsync <InvalidOperationException>(() => Validate.CheckProductCodeExists(MockProductCode)(ProductCodeHelper.ToProductCode("122C").Data)); }