Uploaded image for project: 'Spring.NET'
  1. Spring.NET
  2. SPRNET-1490

NumberUtils.IsZero: invalid cast for Byte and SByte

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 2.0 M1
    • Component/s: Spring-NET-CORE
    • Labels:
      None

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

        Attachments

          Activity

            People

            • Assignee:
              sbohlen Steve Bohlen
              Reporter:
              rpaterlini Roberto Paterlini
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: