Skip to content

Commit 7e89f52

Browse files
author
Jake Ginnivan
committed
Renamed to follow sets idea
1 parent 14f1a6e commit 7e89f52

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

TestStack.ConventionTests/IConventionResult.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,20 @@ void IsSymmetric<TResult>(
2727
/// All dto's live in Project.Dto namespace AND Only dto's live in Project.Dto
2828
/// This means if a DTO is outside of Project.Dto, the test will fail,
2929
/// and if a non-dto is in Project.Dto the test will also fail
30+
///
31+
/// This overload allows you to work with sets, see ....
3032
/// </summary>
3133
/// <typeparam name="TResult">The data type the convention is applied to</typeparam>
32-
/// <param name="conventionResultTitle">Title of the convention, i.e Dto's must live in Project.Dto namespace</param>
33-
/// <param name="inverseResultTitle">The inverse scenario title, i.e Non-dtos must not live inside Project.Dto namespace</param>
34-
/// <param name="isInclusiveData">Predicate describing if the data is included, for example, t => t.Name.EndsWith("Dto")</param>
35-
/// <param name="dataConformsToConvention">
36-
/// Predicate describing the convention, for example, t =>
37-
/// t.NameSpace.StartsWith("Project.Dto")
38-
/// </param>
34+
/// <param name="firstSetFailureTitle">Title of the convention, i.e Dto's must live in Project.Dto namespace</param>
35+
/// <param name="secondSetFailureTitle">The inverse scenario title, i.e Non-dtos must not live inside Project.Dto namespace</param>
3936
/// <param name="allData">All data, for dto example, all types in the project, not just dto's</param>
40-
void IsSymmetric<TResult>(string conventionResultTitle, string inverseResultTitle, Func<TResult, bool> isInclusiveData, Func<TResult, bool> dataConformsToConvention, IEnumerable<TResult> allData);
37+
/// <param name="isPartOfFirstSet">Predicate defining data which is in the first set</param>
38+
/// <param name="isPartOfSecondSet">Predicate defining data which is in the second set</param>
39+
void IsSymmetric<TResult>(
40+
string firstSetFailureTitle,
41+
string secondSetFailureTitle,
42+
Func<TResult, bool> isPartOfFirstSet,
43+
Func<TResult, bool> isPartOfSecondSet,
44+
IEnumerable<TResult> allData);
4145
}
4246
}

TestStack.ConventionTests/Internal/ConventionResult.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@ public void IsSymmetric<TResult>(
4747
inverseFailingData.Select(FormatData).ToArray()));
4848
}
4949

50-
public void IsSymmetric<TResult>(string conventionResultTitle, string inverseResultTitle,
51-
Func<TResult, bool> isInclusiveData, Func<TResult, bool> dataConformsToConvention,
50+
public void IsSymmetric<TResult>(
51+
string firstSetFailureTitle,
52+
string secondSetFailureTitle,
53+
Func<TResult, bool> isPartOfFirstSet,
54+
Func<TResult, bool> isPartOfSecondSet,
5255
IEnumerable<TResult> allData)
5356
{
54-
var conventionFailingData = allData.Where(isInclusiveData).Where(d => !dataConformsToConvention(d));
55-
var inverseFailingData = allData.Where(d => !isInclusiveData(d)).Where(dataConformsToConvention);
57+
var firstSetFailingData = allData.Where(isPartOfFirstSet).Where(d => !isPartOfSecondSet(d));
58+
var secondSetFailingData = allData.Where(d => !isPartOfFirstSet(d)).Where(isPartOfSecondSet);
5659

5760
IsSymmetric(
58-
conventionResultTitle, conventionFailingData,
59-
inverseResultTitle, inverseFailingData);
61+
firstSetFailureTitle, firstSetFailingData,
62+
secondSetFailureTitle, secondSetFailingData);
6063
}
6164

6265
static ConventionReportFailure FormatData<T>(T failingData)

0 commit comments

Comments
 (0)