[SPRNET-1490] NumberUtils.IsZero: invalid cast for Byte and SByte Created: 31/Jan/12  Updated: 17/Apr/12  Resolved: 17/Apr/12

Status: Resolved
Project: Spring.NET
Component/s: Spring-NET-CORE
Affects Version/s: 1.3.2
Fix Version/s: 2.0 M1

Type: Bug Priority: Minor
Reporter: Roberto Paterlini Assignee: Steve Bohlen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Changed there line in NumberUtils.IsZero:

else if (number is Byte)
return ((Byte)number) == 0;
else if (number is SByte)
return ((SByte)number) == 0;

Add this test to NunberUtilsTest:

[Test]
public void IsZero()

{ Assert.IsFalse(NumberUtils.IsZero((Byte)2)); Assert.IsFalse(NumberUtils.IsZero((SByte)2)); Assert.IsTrue(NumberUtils.IsZero((Byte?)0)); Assert.IsTrue(NumberUtils.IsZero((SByte?)0)); }

 Comments   
Comment by Steve Bohlen [ 17/Apr/12 ]

Added support for NumberUtils.IsZero handling Byte and SByte data types, improved test coverage around .IsZero(...) method, fixed several casting oversights in the method

Generated at Fri Jul 19 11:05:13 UTC 2019 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.