|
9 | 9 | using LibGit2Sharp.Tests.TestHelpers; |
10 | 10 | using Xunit; |
11 | 11 | using Xunit.Extensions; |
12 | | -using Moq; |
13 | 12 |
|
14 | 13 | namespace LibGit2Sharp.Tests |
15 | 14 | { |
@@ -83,78 +82,6 @@ public void TypesInLibGit2DecoratedWithDebuggerDisplayMustFollowTheStandardImplP |
83 | 82 | } |
84 | 83 | } |
85 | 84 |
|
86 | | - // Related to https://github.com/libgit2/libgit2sharp/pull/185 |
87 | | - [Fact] |
88 | | - public void TypesInLibGit2SharpMustBeExtensibleInATestingContext() |
89 | | - { |
90 | | - var nonTestableTypes = new Dictionary<Type, IEnumerable<string>>(); |
91 | | - |
92 | | - IEnumerable<Type> libGit2SharpTypes = Assembly.GetAssembly(typeof(IRepository)).GetExportedTypes() |
93 | | - .Where(t => MustBeMockable(t) && t.Namespace == typeof(IRepository).Namespace); |
94 | | - |
95 | | - foreach (Type type in libGit2SharpTypes) |
96 | | - { |
97 | | - if (type.IsInterface || type.IsEnum || IsStatic(type)) |
98 | | - continue; |
99 | | - |
100 | | - var nonVirtualMethodNamesForType = GetNonVirtualPublicMethodsNames(type).ToList(); |
101 | | - if (nonVirtualMethodNamesForType.Any()) |
102 | | - { |
103 | | - nonTestableTypes.Add(type, nonVirtualMethodNamesForType); |
104 | | - continue; |
105 | | - } |
106 | | - |
107 | | - if (!HasEmptyPublicOrProtectedConstructor(type)) |
108 | | - { |
109 | | - nonTestableTypes.Add(type, new List<string>()); |
110 | | - } |
111 | | - |
112 | | - if (type.IsAbstract) |
113 | | - { |
114 | | - continue; |
115 | | - } |
116 | | - |
117 | | - try |
118 | | - { |
119 | | - if (type.ContainsGenericParameters) |
120 | | - { |
121 | | - var constructType = type.MakeGenericType(Enumerable.Repeat(typeof(object), type.GetGenericArguments().Length).ToArray()); |
122 | | - Activator.CreateInstance(constructType, true); |
123 | | - } |
124 | | - else |
125 | | - { |
126 | | - Activator.CreateInstance(type, true); |
127 | | - } |
128 | | - } |
129 | | - catch |
130 | | - { |
131 | | - nonTestableTypes.Add(type, new List<string>()); |
132 | | - } |
133 | | - } |
134 | | - |
135 | | - if (nonTestableTypes.Any()) |
136 | | - { |
137 | | - Assert.True(false, Environment.NewLine + BuildNonTestableTypesMessage(nonTestableTypes)); |
138 | | - } |
139 | | - } |
140 | | - |
141 | | - private static bool MustBeMockable(Type type) |
142 | | - { |
143 | | - if (type.IsSealed) |
144 | | - { |
145 | | - return false; |
146 | | - } |
147 | | - |
148 | | - if (type.IsAbstract) |
149 | | - { |
150 | | - return !type.Assembly.GetExportedTypes() |
151 | | - .Where(t => t.IsSubclassOf(type)) |
152 | | - .All(t => t.IsAbstract || t.IsSealed); |
153 | | - } |
154 | | - |
155 | | - return true; |
156 | | - } |
157 | | - |
158 | 85 | [Fact] |
159 | 86 | public void LibGit2SharpPublicInterfacesCoverAllPublicMembers() |
160 | 87 | { |
|
0 commit comments