[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


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:

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)); }

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 Wed Oct 23 08:36:06 UTC 2019 using Jira 7.13.8#713008-sha1:1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6.