Skip to content

Commit af79546

Browse files
committed
Removing min value range check when converting from nullable unsigned numeric source values
1 parent 4ec94ea commit af79546

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

AgileMapper.UnitTests/SimpleTypeConversion/WhenConvertingToInts.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ public void ShouldMapATooBigUnsignedLongToAnInt()
8686
}
8787

8888
[Fact]
89-
public void ShouldMapATooBigUnsignedLongToANullableInt()
89+
public void ShouldMapATooBigUnsignedNullableLongToANullableInt()
9090
{
91-
var source = new PublicField<ulong> { Value = ulong.MaxValue };
91+
var source = new PublicField<ulong?> { Value = ulong.MaxValue };
9292
var result = Mapper.Map(source).ToANew<PublicProperty<int?>>();
9393

9494
result.Value.ShouldBeNull();

AgileMapper/TypeConversion/NumericValueIsInRangeComparison.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static Expression For(Expression sourceValue, Type nonNullableTargetType)
2323
var sourceValueIsLessThanOrEqualToMaxValue =
2424
Expression.LessThanOrEqual(maxValueComparisonLeftSide, maxValueComparisonRightSide);
2525

26-
if (sourceValue.Type.IsUnsignedNumeric())
26+
if (sourceValue.Type.GetNonNullableType().IsUnsignedNumeric())
2727
{
2828
return sourceValueIsLessThanOrEqualToMaxValue;
2929
}

0 commit comments

Comments
 (0)