tests/DotNetCommon.Test/Extensions/TypeExtensions/CheckingTypeIsNumeric.cs

(完整代码) 1KB

namespace DotNetCommon.Test.Extensions.TypeExtensions
{
    using System;
    using NUnit.Framework;
    using Shouldly;
    using DotNetCommon.Extensions;

    [TestFixture]
    internal sealed class CheckingTypeIsNumeric
    {
        [Test]
        public void Run()
        {
            typeof(bool).IsNumeric().ShouldBeFalse();
            typeof(string).IsNumeric().ShouldBeFalse();
            typeof(DateTime).IsNumeric().ShouldBeFalse();
            typeof(TimeSpan).IsNumeric().ShouldBeFalse();

            typeof(byte).IsNumeric().ShouldBeTrue();
            typeof(float).IsNumeric().ShouldBeTrue();
            typeof(decimal).IsNumeric().ShouldBeTrue();
            typeof(double).IsNumeric().ShouldBeTrue();
            typeof(short).IsNumeric().ShouldBeTrue();
            typeof(int).IsNumeric().ShouldBeTrue();
            typeof(long).IsNumeric().ShouldBeTrue();
            typeof(sbyte).IsNumeric().ShouldBeTrue();
            typeof(ushort).IsNumeric().ShouldBeTrue();
            typeof(uint).IsNumeric().ShouldBeTrue();
            typeof(ulong).IsNumeric().ShouldBeTrue();
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。