以下の内容はhttps://baba-s.hatenablog.com/entry/2023/04/20/085733より取得しました。


【Unity】2 つのコレクションに差集合があれば Test Runner でテスト失敗にするクラス

ソースコード

using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;

namespace Kogane
{
    internal static class ExceptTester
    {
        public static void Test<T>
        (
            string         message,
            IEnumerable<T> source1,
            IEnumerable<T> source2
        )
        {
            var result = source1
                    .Except( source2 )
                    .ToArray()
                ;

            if ( result.Length <= 0 ) return;

            Assert.Fail
            (
                $@"{message}

{string.Join( "\n", result.Select( x => x.ToString() ) )}"
            );
        }
    }
}

使用例

ExceptTester.Test
(
    "【ここにメッセージ】",
    new[] { 1, 2, 3 },
    new[] { 2, 3 }
);



以上の内容はhttps://baba-s.hatenablog.com/entry/2023/04/20/085733より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14