internal static void AssertEquivalent(this ISetAttributeRangeParameters expected, ChileProductAttributeRange actual) { Assert.AreEqual(expected.AttributeNameKey, actual.ToAttributeNameKey().KeyValue); Assert.AreEqual(expected.RangeMin, actual.RangeMin); Assert.AreEqual(expected.RangeMax, actual.RangeMax); }
internal static IResult <SetChileProductAttributeRangeParameters> ToParsedParameters(this ISetAttributeRangeParameters parameters) { if (parameters == null) { throw new ArgumentNullException("parameters"); } if (parameters.RangeMin > parameters.RangeMax) { return(new InvalidResult <SetChileProductAttributeRangeParameters>(null, UserMessages.ChileProductAttributeRangeMinGreaterThanMax)); } var attributeNameKey = KeyParserHelper.ParseResult <IAttributeNameKey>(parameters.AttributeNameKey); if (!attributeNameKey.Success) { return(attributeNameKey.ConvertTo <SetChileProductAttributeRangeParameters>()); } return(new SuccessResult().ConvertTo(new SetChileProductAttributeRangeParameters { Parameters = parameters, AttributeNameKey = attributeNameKey.ResultingObject.ToAttributeNameKey() })); }