public void MD5_Test()
        {
            foreach (var item in MD5_TestSource)
            {
                if (!AssertException.TryExecute(() => StringConvert.MD5(item.message, item.encoding), item.expectedExceptionType, out var actual))
                {
                    continue;
                }

                actual.Is <byte>(item.expected, item);
            }
        }
Exemplo n.º 2
0
        public void ToHexString_Test()
        {
            foreach (var item in ToHexString_TestSource)
            {
                if (!AssertException.TryExecute(() => item.data.ToHexString(item.toUpper), item.expectedExceptionType, out var actual))
                {
                    continue;
                }

                actual.Is(item.expected, item);
            }
        }
Exemplo n.º 3
0
        public void OrderByWeight()
        {
            foreach (var item in TestCases())
            {
                var message = $"No.{item.testNumber}";
                if (!AssertException.TryExecute(() => EnumerableExtensions.OrderByWeight(item.source, item.weightSelector).ToArray(), item.expectedExceptionType, out var actual, message))
                {
                    continue;
                }

                actual.OrderBy(_ => _).Is(item.source.OrderBy(_ => _), message);
            }

            // テストケース定義。
            IEnumerable <(int testNumber, int[] source, Func <int, double> weightSelector, Type expectedExceptionType)> TestCases() => new(int testNumber, int[] source, Func <int, double> weightSelector, Type expectedExceptionType)[]