tests/DotNetCommon.Test/Extensions/TypeExtensions/CheckingATypeIsSimpleTests.cs
(完整代码) 1KBnamespace DotNetCommon.Test.Extensions.TypeExtensions
{
using System;
using NUnit.Framework;
using Shouldly;
using DotNetCommon.Extensions;
[TestFixture]
public sealed class CheckingATypeIsSimpleTests
{
[Test]
public void Run()
{
typeof (byte[]).IsSimpleType().ShouldBeTrue();
typeof (byte).IsSimpleType().ShouldBeTrue();
typeof (sbyte).IsSimpleType().ShouldBeTrue();
typeof (short).IsSimpleType().ShouldBeTrue();
typeof (ushort).IsSimpleType().ShouldBeTrue();
typeof (int).IsSimpleType().ShouldBeTrue();
typeof (uint).IsSimpleType().ShouldBeTrue();
typeof (long).IsSimpleType().ShouldBeTrue();
typeof (ulong).IsSimpleType().ShouldBeTrue();
typeof (float).IsSimpleType().ShouldBeTrue();
typeof (double).IsSimpleType().ShouldBeTrue();
typeof (decimal).IsSimpleType().ShouldBeTrue();
typeof (bool).IsSimpleType().ShouldBeTrue();
typeof (string).IsSimpleType().ShouldBeTrue();
typeof (char).IsSimpleType().ShouldBeTrue();
typeof (Guid).IsSimpleType().ShouldBeTrue();
typeof (DateTime).IsSimpleType().ShouldBeTrue();
typeof (DateTimeOffset).IsSimpleType().ShouldBeTrue();
typeof (TimeSpan).IsSimpleType().ShouldBeTrue();
typeof(MyEnum).IsSimpleType().ShouldBeTrue();
typeof(MyClass).IsSimpleType().ShouldBeFalse();
typeof(MyStruct).IsSimpleType().ShouldBeFalse();
typeof(IMyInterface).IsSimpleType().ShouldBeFalse();
}
private enum MyEnum
{
None = 0
}
private class MyClass
{}
private struct MyStruct
{}
private interface IMyInterface
{}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
