tests/DotNetCommon.Test/Extensions/StringExtensionsTests.cs

(开头部分) 24KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using NUnit.Framework;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotNetCommon.Extensions;
using Newtonsoft.Json.Linq;
using System.Text.Json.Nodes;
using System.Text.Json;

namespace DotNetCommon.Test.Extensions
{
    [TestFixture]
    public class StringExtensionsTests
    {
        [TestCase("abc", false)]
        [TestCase("_", false)]
        [TestCase(" ", false)]
        [TestCase("", true)]
        [TestCase(null, true)]
        [TestCase(null, true)]
        public void When_checking_a_string_is_null_or_empty(string input, bool result)
        {
            input.IsNullOrEmpty().ShouldBe(result);
        }

        [TestCase("abc", true)]
        [TestCase("_", true)]
        [TestCase(" ", true)]
        [TestCase("", false)]
        [TestCase(null, false)]
        public void When_checking_a_string_is_not_null_or_empty(string input, bool result)
        {
            input.IsNotNullOrEmpty().ShouldBe(result);
        }

        [TestCase("abc", false)]
        [TestCase("abc ", false)]
        [TestCase(" abc", false)]
        [TestCase(" abc ", false)]
        [TestCase("_", false)]
        [TestCase(" ", true)]
        [TestCase("", true)]
        [TestCase(null, true)]
        public void When_checking_a_string_is_null_or_empty_or_white_space(string input, bool result)
        {
            input.IsNullOrEmptyOrWhiteSpace().ShouldBe(result);
        }

        [TestCase("abc", true)]
        [TestCase("abc ", true)]
        [TestCase(" abc", true)]
        [TestCase(" abc ", true)]
        [TestCase("_", true)]
        [TestCase(" ", false)]
        [TestCase("", false)]
        [TestCase(null, false)]
        public void When_checking_a_string_is_not_null_or_empty_or_white_space(string input, bool result)
        {
后面还有 602 行代码,解锁后查看完整代码

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

AI 解读

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

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