Skip to content

Commit ccc8237

Browse files
author
Jake Ginnivan
committed
Removed second type parameter on conventions
1 parent ece1346 commit ccc8237

9 files changed

+32
-33
lines changed

TestStack.ConventionTests.Tests/ConventionAssertionClassTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public ConventionReportFailure Format(string failingData)
3434
}
3535
}
3636

37-
public class FailingConvention : IConvention<FakeData, string>
37+
public class FailingConvention : IConvention<FakeData>
3838
{
3939
public string ConventionTitle { get { return "Header"; } }
40-
public IEnumerable<string> GetFailingData(FakeData data)
40+
public IEnumerable<object> GetFailingData(FakeData data)
4141
{
4242
return new[] {"Different"};
4343
}

TestStack.ConventionTests/Convention.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ static Convention()
3131
public static IEnumerable<ResultInfo> ConventionReports { get { return Reports; } }
3232
public static IList<IReportDataFormatter> Formatters { get; private set; }
3333

34-
public static void Is<TDataSource, TDataType>(IConvention<TDataSource, TDataType> convention, TDataSource data)
34+
public static void Is<TDataSource>(IConvention<TDataSource> convention, TDataSource data)
3535
where TDataSource : IConventionData
3636
{
3737
Is(convention, data, new ConventionResultExceptionReporter());
3838
}
3939

40-
public static void Is<TDataSource, TDataType>(IConvention<TDataSource, TDataType> convention, TDataSource data, IConventionReportRenderer reporter)
40+
public static void Is<TDataSource>(IConvention<TDataSource> convention, TDataSource data, IConventionReportRenderer reporter)
4141
where TDataSource : IConventionData
4242
{
4343
try
@@ -55,7 +55,7 @@ public static void Is<TDataSource, TDataType>(IConvention<TDataSource, TDataType
5555
}
5656
}
5757

58-
public static void IsWithApprovedExeptions<TDataSource, TDataType>(IConvention<TDataSource, TDataType> convention, TDataSource data)
58+
public static void IsWithApprovedExeptions<TDataSource>(IConvention<TDataSource> convention, TDataSource data)
5959
where TDataSource : IConventionData
6060
{
6161
var conventionResult = GetConventionReport(convention.ConventionTitle, convention.GetFailingData(data).ToArray(), data);
@@ -82,13 +82,13 @@ public static void IsWithApprovedExeptions<TDataSource, TDataType>(IConvention<T
8282
}
8383
}
8484

85-
public static void Is<TDataSource, TDataType>(ISymmetricConvention<TDataSource, TDataType> convention, TDataSource data)
85+
public static void Is<TDataSource>(ISymmetricConvention<TDataSource> convention, TDataSource data)
8686
where TDataSource : IConventionData
8787
{
8888
Is(convention, data, new ConventionResultExceptionReporter());
8989
}
9090

91-
public static void Is<TDataSource, TDataType>(ISymmetricConvention<TDataSource, TDataType> convention, TDataSource data, IConventionReportRenderer reporter)
91+
public static void Is<TDataSource>(ISymmetricConvention<TDataSource> convention, TDataSource data, IConventionReportRenderer reporter)
9292
where TDataSource : IConventionData
9393
{
9494
try
@@ -108,7 +108,7 @@ public static void Is<TDataSource, TDataType>(ISymmetricConvention<TDataSource,
108108
}
109109
}
110110

111-
public static void IsWithApprovedExeptions<TDataSource, TDataType>(ISymmetricConvention<TDataSource, TDataType> convention, TDataSource data)
111+
public static void IsWithApprovedExeptions<TDataSource>(ISymmetricConvention<TDataSource> convention, TDataSource data)
112112
where TDataSource : IConventionData
113113
{
114114
var conventionResult = GetConventionReport(convention.ConventionTitle, convention.GetFailingData(data).ToArray(), data);

TestStack.ConventionTests/Conventions/AllClassesHaveDefaultConstructor.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
namespace TestStack.ConventionTests.Conventions
22
{
3-
using System;
43
using System.Collections.Generic;
54
using System.Linq;
65
using TestStack.ConventionTests.ConventionData;
76
using TestStack.ConventionTests.Internal;
87

9-
public class AllClassesHaveDefaultConstructor : IConvention<Types, Type>
8+
public class AllClassesHaveDefaultConstructor : IConvention<Types>
109
{
1110
public string ConventionTitle { get { return "Types must have a default constructor"; } }
1211

13-
public IEnumerable<Type> GetFailingData(Types data)
12+
public IEnumerable<object> GetFailingData(Types data)
1413
{
1514
return data.TypesToVerify.Where(t => t.HasDefaultConstructor() == false);
1615
}

TestStack.ConventionTests/Conventions/AllMethodsAreVirtual.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
using TestStack.ConventionTests.ConventionData;
77
using TestStack.ConventionTests.Internal;
88

9-
public class AllMethodsAreVirtual : IConvention<Types, MethodInfo>
9+
public class AllMethodsAreVirtual : IConvention<Types>
1010
{
1111
public string ConventionTitle { get { return "Methods must be virtual"; } }
1212

13-
public IEnumerable<MethodInfo> GetFailingData(Types data)
13+
public IEnumerable<object> GetFailingData(Types data)
1414
{
1515
return data.TypesToVerify.SelectMany(t => t.NonVirtualMethods());
1616
}

TestStack.ConventionTests/Conventions/ClassTypeHasSpecificNamespace.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
///
1515
/// This is a Symmetric convention, and will verify all of a Class Type lives in the namespace, but also that only that class type is in that namespace
1616
/// </summary>
17-
public class ClassTypeHasSpecificNamespace : ISymmetricConvention<Types, Type>
17+
public class ClassTypeHasSpecificNamespace : ISymmetricConvention<Types>
1818
{
1919
readonly Func<Type, bool> classIsApplicable;
2020
readonly string namespaceToCheck;
@@ -49,14 +49,14 @@ public string InverseTitle
4949
}
5050
}
5151

52-
public IEnumerable<Type> GetFailingData(Types data)
52+
public IEnumerable<object> GetFailingData(Types data)
5353
{
5454
return data.TypesToVerify
5555
.Where(classIsApplicable)
5656
.Where(t => t.Namespace == null || !t.Namespace.StartsWith(namespaceToCheck));
5757
}
5858

59-
public IEnumerable<Type> GetFailingInverseData(Types data)
59+
public IEnumerable<object> GetFailingInverseData(Types data)
6060
{
6161
return data.TypesToVerify
6262
.Where(t => !classIsApplicable(t))

TestStack.ConventionTests/Conventions/FilesAreEmbeddedResources.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Linq;
55
using TestStack.ConventionTests.ConventionData;
66

7-
public class FilesAreEmbeddedResources : IConvention<ProjectFiles, ProjectFile>
7+
public class FilesAreEmbeddedResources : IConvention<ProjectFiles>
88
{
99
public FilesAreEmbeddedResources(string fileExtension)
1010
{
@@ -21,7 +21,7 @@ public string ConventionTitle
2121

2222
public string FileExtension { get; set; }
2323

24-
public IEnumerable<ProjectFile> GetFailingData(ProjectFiles data)
24+
public IEnumerable<object> GetFailingData(ProjectFiles data)
2525
{
2626
return data.Files.Where(s => s.FilePath.EndsWith(FileExtension) && s.ReferenceType != "EmbeddedResource");
2727
}
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
namespace TestStack.ConventionTests.Conventions
2-
{
3-
using System.Collections.Generic;
4-
5-
public interface ISymmetricConvention<in T, out TDataType> where T : IConventionData
6-
{
7-
string ConventionTitle { get; }
8-
string InverseTitle { get; }
9-
IEnumerable<TDataType> GetFailingData(T data);
10-
IEnumerable<TDataType> GetFailingInverseData(T data);
11-
}
1+
namespace TestStack.ConventionTests.Conventions
2+
{
3+
using System.Collections.Generic;
4+
5+
public interface ISymmetricConvention<in T> where T : IConventionData
6+
{
7+
string ConventionTitle { get; }
8+
string InverseTitle { get; }
9+
IEnumerable<object> GetFailingData(T data);
10+
IEnumerable<object> GetFailingInverseData(T data);
11+
}
1212
}

TestStack.ConventionTests/Conventions/ProjectDoesNotReferenceDllsFromBinOrObjDirectories.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Text.RegularExpressions;
66
using TestStack.ConventionTests.ConventionData;
77

8-
public class ProjectDoesNotReferenceDllsFromBinOrObjDirectories : IConvention<ProjectReferences, ProjectReference>
8+
public class ProjectDoesNotReferenceDllsFromBinOrObjDirectories : IConvention<ProjectReferences>
99
{
1010
const string AssemblyReferencingObjRegex = @"^(?<assembly>.*?(obj|bin).*?)$";
1111

@@ -16,7 +16,7 @@ static bool IsBinOrObjReference(ProjectReference reference)
1616

1717
public string ConventionTitle { get { return "Project must not reference dlls from bin or obj directories"; } }
1818

19-
public IEnumerable<ProjectReference> GetFailingData(ProjectReferences data)
19+
public IEnumerable<object> GetFailingData(ProjectReferences data)
2020
{
2121
return data.References.Where(IsBinOrObjReference);
2222
}

TestStack.ConventionTests/IConvention.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
{
33
using System.Collections.Generic;
44

5-
public interface IConvention<in T, out TDataType> where T : IConventionData
5+
public interface IConvention<in T> where T : IConventionData
66
{
77
string ConventionTitle { get; }
8-
IEnumerable<TDataType> GetFailingData(T data);
8+
IEnumerable<object> GetFailingData(T data);
99
}
1010
}

0 commit comments

Comments
 (0)