Welcome to mirror list, hosted at ThFree Co, Russian Federation.

XUnit.cs « Shims « Tests « Scripts « Assets « MessagePack.UnityClient « src - github.com/aspnet/MessagePack-CSharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f1eee26942dd5530dfc776f189cb6840355be649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Xunit to NUnit bridge.

using NUnit.Framework;
using System.Linq;
using System.Collections.Generic;
using System;
using System.Runtime.Serialization;
using System.Threading.Tasks;

namespace Xunit
{
    public class FactAttribute : NUnit.Framework.TestAttribute
    {
        public string Skip { get; set; }
    }

    public class SkippableFactAttribute : FactAttribute
    {
    }

    public class TheoryAttribute : FactAttribute
    {
    }

    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
    public sealed class InlineDataAttribute : NUnit.Framework.TestCaseAttribute
    {
        public InlineDataAttribute(params Object[] data)
            : base(data)
        {
        }
    }

    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
    public sealed class MemberDataAttribute : NUnit.Framework.TestCaseSourceAttribute
    {
        public MemberDataAttribute(string memberName)
            : base(memberName)
        {
        }
    }

    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
    public sealed class TraitAttribute : Attribute
    {
        public TraitAttribute(string name, string value)
        {
        }
    }

    public static class Skip
    {
        public static void If(bool condition)
        {
        }
    }

    public static class Assert
    {
        public static T Throws<T>(Action action) where T : Exception
        {
            return NUnit.Framework.Assert.Throws<T>(new TestDelegate(action));
        }

        public static Task<T> ThrowsAsync<T>(Func<Task> action) where T : Exception
        {
            return Task.FromResult(Throws<T>(() => action().GetAwaiter().GetResult()));
        }

        public static T Throws<T>(Func<object> action) where T : Exception
        {
            return NUnit.Framework.Assert.Throws<T>(() => action());
        }

        public static void True(bool value)
        {
            NUnit.Framework.Assert.IsTrue(value);
        }

        public static void False(bool value)
        {
            NUnit.Framework.Assert.IsFalse(value);
        }

        public static void Null(object expected)
        {
            NUnit.Framework.Assert.IsNull(expected);
        }

        public static void Empty(System.Collections.IEnumerable enumerable)
        {
            Assert.False(enumerable.GetEnumerator().MoveNext());
        }

        public static void All<T>(IEnumerable<T> collection, Action<T> predicate)
        {
            foreach (T item in collection)
            {
                predicate(item);
            }
        }

        public static T IsType<T>(object o)
        {
            NUnit.Framework.Assert.AreEqual(typeof(T), o.GetType());
            return (T)o;
        }

        public static void Equal<T>(T expected, T actual)
        {
            NUnit.Framework.Assert.AreEqual(expected, actual);
        }

        public static void NotEqual<T>(T expected, T actual)
        {
            NUnit.Framework.Assert.AreNotEqual(expected, actual);
        }

        public static void NotEmpty<T>(ICollection<T> source)
        {
            NUnit.Framework.Assert.IsTrue(source.Count != 0);
        }

        public static void NotNull(object value)
        {
            NUnit.Framework.Assert.IsNotNull(value);
        }

        public static void Same(object expected, object actual)
        {
            NUnit.Framework.Assert.AreSame(expected, actual);
        }

        public static void NotSame(object expected, object actual)
        {
            NUnit.Framework.Assert.AreNotSame(expected, actual);
        }
    }

    [Serializable]
    public class AssertFailedException : NUnit.Framework.AssertionException
    {
        public AssertFailedException()
            : base("")
        {
        }

        public AssertFailedException(string message) : base(message)
        {
        }

        public AssertFailedException(string message, Exception innerException) : base(message, innerException)
        {
        }
    }
}

namespace Xunit.Abstractions
{
    public interface ITestOutputHelper
    {
        void WriteLine(String message);
        void WriteLine(String format, params Object[] args);
    }
}