Skip to content

Commit 3d53abb

Browse files
committed
Merge pull request #39 from TestStack/documentation-update
Documentation update
2 parents 67df72a + df1a600 commit 3d53abb

File tree

7 files changed

+79
-225
lines changed

7 files changed

+79
-225
lines changed

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Contributor Guidelines
2+
======================
3+
4+
Hi! Thank you for your interest in contributing to this open source library!
5+
6+
We welcome issues and pull requests. If you are starting on something major
7+
please raise an issue first so we can discuss it with you, make sure it fits
8+
in with the direction of the project and provide appropriate assistance :)
9+
10+
We ask that you follow the following style guidelines when submitting pull
11+
requests, to keep the code consistent and maintainable.
12+
13+
- In general - follow the default ReSharper suggestions
14+
- Do not put a single line if clause on the same line as the if statement it
15+
belongs to; separate them with a new-line and an indent

CONTRIBUTOR_GUIDELINES.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

NextVersion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.0
1+
3.1.0

README.md

Lines changed: 27 additions & 181 deletions
Large diffs are not rendered by default.

TestStack.Dossier.Tests/BuildTests.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,6 @@ public void GivenBuilder_WhenCallingSetExplicitly_ShouldOverrideValues()
4848
customer.YearJoined.ShouldBe(2014);
4949
}
5050

51-
[Fact]
52-
public void GivenBuilder_WhenCallingSetWithLambda_ShouldInvokeEachTime()
53-
{
54-
int counter = 2014;
55-
var builder = new CustomerBuilder()
56-
.Set(x => x.FirstName, "Pi")
57-
.Set(x => x.LastName, "Lanningham")
58-
.Set(x => x.YearJoined, () => counter++);
59-
60-
var customerA = builder.Build();
61-
var customerB = builder.Build();
62-
63-
customerA.YearJoined.ShouldBe(2014);
64-
customerB.YearJoined.ShouldBe(2015);
65-
66-
List<Customer> customerList = CustomerBuilder.CreateListOfSize(10)
67-
.All()
68-
.Set(x => x.YearJoined, () => counter++);
69-
int newCounter = 2016;
70-
foreach (var c in customerList)
71-
{
72-
c.YearJoined.ShouldBe(newCounter++);
73-
}
74-
75-
}
76-
7751
[Fact]
7852
public void GivenBasicBuilder_WhenCallingBuildImplicitly_ThenReturnAnObject()
7953
{

TestStack.Dossier.Tests/Builder_CreateListTests.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public void WhenBuildingObjectsImplicitly_ThenTheAnonymousValueFixtureIsSharedAc
170170
studentViewModels.Select(x => x.Grade).ShouldBeUnique();
171171
}
172172

173-
public void WhenBuildingObjectsWithCtorAndPrivateSetters_ShouldSetPrivateSettersByDefault()
173+
public void WhenBuildingObjectsWithCtorAndPrivateSetters_ThenSetPrivateSettersByDefault()
174174
{
175175
var dto = Builder<MixedAccessibilityDto>.CreateListOfSize(1)
176176
.TheFirst(1)
@@ -188,7 +188,7 @@ public void WhenBuildingObjectsWithCtorAndPrivateSetters_ShouldSetPrivateSetters
188188
}
189189

190190
[Fact]
191-
public void GivenBuilderListWithFactoryOverride_WhenBuildingObjects_ShouldRespectOverriddenFactory()
191+
public void GivenBuilderListWithFactoryOverride_WhenBuildingObjects_ThenRespectOverriddenFactory()
192192
{
193193
var dto = Builder<MixedAccessibilityDto>.CreateListOfSize(1, new CallConstructorFactory())
194194
.TheFirst(1)
@@ -204,5 +204,18 @@ public void GivenBuilderListWithFactoryOverride_WhenBuildingObjects_ShouldRespec
204204
dto.NotSetByCtorWithPrivateSetter.ShouldNotBe("3");
205205
dto.NotSetByCtorWithPublicSetter.ShouldNotBe("4");
206206
}
207+
208+
[Fact]
209+
public void GivenBuilder_WhenCallingSetWithLambda_ThenInvokeEachTime()
210+
{
211+
var grade = Grade.A;
212+
var customers = Builder<StudentViewModel>.CreateListOfSize(10)
213+
.All().Set(x => x.Grade, () => grade++)
214+
.BuildList();
215+
216+
var gradeAssertion = Grade.A;
217+
foreach (var c in customers)
218+
c.Grade.ShouldBe(gradeAssertion++);
219+
}
207220
}
208221
}

TestStack.Dossier.Tests/Builder_CreateNewTests.cs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using Shouldly;
34
using TestStack.Dossier.Factories;
45
using TestStack.Dossier.Tests.TestHelpers.Objects.Examples;
@@ -29,7 +30,7 @@ public void GivenBuilder_WhenCallingBuildImplicitly_ThenReturnAnObject()
2930
}
3031

3132
[Fact]
32-
public void GivenBuilderWithModifications_WhenCallingBuildExplicitly_ShouldOverrideValues()
33+
public void GivenBuilderWithModifications_WhenCallingBuildExplicitly_ThenOverrideValues()
3334
{
3435
var builder = Builder<StudentViewModel>.CreateNew()
3536
.Set(x => x.FirstName, "Pi")
@@ -44,7 +45,7 @@ public void GivenBuilderWithModifications_WhenCallingBuildExplicitly_ShouldOverr
4445
}
4546

4647
[Fact]
47-
public void GivenBuilderWithModifications_WhenCallingBuildImplicitly_ShouldOverrideValues()
48+
public void GivenBuilderWithModifications_WhenCallingBuildImplicitly_ThenOverrideValues()
4849
{
4950
StudentViewModel vm = Builder<StudentViewModel>.CreateNew()
5051
.Set(x => x.FirstName, "Pi")
@@ -57,7 +58,7 @@ public void GivenBuilderWithModifications_WhenCallingBuildImplicitly_ShouldOverr
5758
}
5859

5960
[Fact]
60-
public void GivenBuilder_WhenBuildingObjectWithCtorAndPrivateSetters_ShouldSetPrivateSettersByDefault()
61+
public void GivenBuilder_WhenBuildingObjectWithCtorAndPrivateSetters_ThenSetPrivateSettersByDefault()
6162
{
6263
MixedAccessibilityDto dto = Builder<MixedAccessibilityDto>.CreateNew()
6364
.Set(x => x.SetByCtorWithPublicSetter, "1")
@@ -72,7 +73,7 @@ public void GivenBuilder_WhenBuildingObjectWithCtorAndPrivateSetters_ShouldSetPr
7273
}
7374

7475
[Fact]
75-
public void GivenBuilderWithFactoryOverride_WhenBuildingObject_ShouldRespectOverriddenFactory()
76+
public void GivenBuilderWithFactoryOverride_WhenBuildingObject_ThenRespectOverriddenFactory()
7677
{
7778
MixedAccessibilityDto dto = Builder<MixedAccessibilityDto>.CreateNew(new CallConstructorFactory())
7879
.Set(x => x.SetByCtorWithPublicSetter, "1")
@@ -85,5 +86,21 @@ public void GivenBuilderWithFactoryOverride_WhenBuildingObject_ShouldRespectOver
8586
dto.NotSetByCtorWithPrivateSetter.ShouldNotBe("3");
8687
dto.NotSetByCtorWithPublicSetter.ShouldNotBe("4");
8788
}
89+
90+
[Fact]
91+
public void GivenBuilder_WhenCallingSetWithLambda_ThenInvokeEachTime()
92+
{
93+
var grade = Grade.A;
94+
var builder = Builder<StudentViewModel>.CreateNew()
95+
.Set(x => x.FirstName, "Pi")
96+
.Set(x => x.LastName, "Lanningham")
97+
.Set(x => x.Grade, () => grade++);
98+
99+
var customerA = builder.Build();
100+
var customerB = builder.Build();
101+
102+
customerA.Grade.ShouldBe(Grade.A);
103+
customerB.Grade.ShouldBe(Grade.B);
104+
}
88105
}
89106
}

0 commit comments

Comments
 (0)