Skip to content

Commit

Permalink
Merge pull request #39 from TestStack/documentation-update
Browse files Browse the repository at this point in the history
Documentation update
  • Loading branch information
robdmoore committed May 24, 2015
2 parents 67df72a + df1a600 commit 3d53abb
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 225 deletions.
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Contributor Guidelines
======================

Hi! Thank you for your interest in contributing to this open source library!

We welcome issues and pull requests. If you are starting on something major
please raise an issue first so we can discuss it with you, make sure it fits
in with the direction of the project and provide appropriate assistance :)

We ask that you follow the following style guidelines when submitting pull
requests, to keep the code consistent and maintainable.

- In general - follow the default ReSharper suggestions
- Do not put a single line if clause on the same line as the if statement it
belongs to; separate them with a new-line and an indent
11 changes: 0 additions & 11 deletions CONTRIBUTOR_GUIDELINES.md

This file was deleted.

2 changes: 1 addition & 1 deletion NextVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.1.0
208 changes: 27 additions & 181 deletions README.md

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions TestStack.Dossier.Tests/BuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,6 @@ public void GivenBuilder_WhenCallingSetExplicitly_ShouldOverrideValues()
customer.YearJoined.ShouldBe(2014);
}

[Fact]
public void GivenBuilder_WhenCallingSetWithLambda_ShouldInvokeEachTime()
{
int counter = 2014;
var builder = new CustomerBuilder()
.Set(x => x.FirstName, "Pi")
.Set(x => x.LastName, "Lanningham")
.Set(x => x.YearJoined, () => counter++);

var customerA = builder.Build();
var customerB = builder.Build();

customerA.YearJoined.ShouldBe(2014);
customerB.YearJoined.ShouldBe(2015);

List<Customer> customerList = CustomerBuilder.CreateListOfSize(10)
.All()
.Set(x => x.YearJoined, () => counter++);
int newCounter = 2016;
foreach (var c in customerList)
{
c.YearJoined.ShouldBe(newCounter++);
}

}

[Fact]
public void GivenBasicBuilder_WhenCallingBuildImplicitly_ThenReturnAnObject()
{
Expand Down
17 changes: 15 additions & 2 deletions TestStack.Dossier.Tests/Builder_CreateListTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void WhenBuildingObjectsImplicitly_ThenTheAnonymousValueFixtureIsSharedAc
studentViewModels.Select(x => x.Grade).ShouldBeUnique();
}

public void WhenBuildingObjectsWithCtorAndPrivateSetters_ShouldSetPrivateSettersByDefault()
public void WhenBuildingObjectsWithCtorAndPrivateSetters_ThenSetPrivateSettersByDefault()
{
var dto = Builder<MixedAccessibilityDto>.CreateListOfSize(1)
.TheFirst(1)
Expand All @@ -188,7 +188,7 @@ public void WhenBuildingObjectsWithCtorAndPrivateSetters_ShouldSetPrivateSetters
}

[Fact]
public void GivenBuilderListWithFactoryOverride_WhenBuildingObjects_ShouldRespectOverriddenFactory()
public void GivenBuilderListWithFactoryOverride_WhenBuildingObjects_ThenRespectOverriddenFactory()
{
var dto = Builder<MixedAccessibilityDto>.CreateListOfSize(1, new CallConstructorFactory())
.TheFirst(1)
Expand All @@ -204,5 +204,18 @@ public void GivenBuilderListWithFactoryOverride_WhenBuildingObjects_ShouldRespec
dto.NotSetByCtorWithPrivateSetter.ShouldNotBe("3");
dto.NotSetByCtorWithPublicSetter.ShouldNotBe("4");
}

[Fact]
public void GivenBuilder_WhenCallingSetWithLambda_ThenInvokeEachTime()
{
var grade = Grade.A;
var customers = Builder<StudentViewModel>.CreateListOfSize(10)
.All().Set(x => x.Grade, () => grade++)
.BuildList();

var gradeAssertion = Grade.A;
foreach (var c in customers)
c.Grade.ShouldBe(gradeAssertion++);
}
}
}
25 changes: 21 additions & 4 deletions TestStack.Dossier.Tests/Builder_CreateNewTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Shouldly;
using TestStack.Dossier.Factories;
using TestStack.Dossier.Tests.TestHelpers.Objects.Examples;
Expand Down Expand Up @@ -29,7 +30,7 @@ public void GivenBuilder_WhenCallingBuildImplicitly_ThenReturnAnObject()
}

[Fact]
public void GivenBuilderWithModifications_WhenCallingBuildExplicitly_ShouldOverrideValues()
public void GivenBuilderWithModifications_WhenCallingBuildExplicitly_ThenOverrideValues()
{
var builder = Builder<StudentViewModel>.CreateNew()
.Set(x => x.FirstName, "Pi")
Expand All @@ -44,7 +45,7 @@ public void GivenBuilderWithModifications_WhenCallingBuildExplicitly_ShouldOverr
}

[Fact]
public void GivenBuilderWithModifications_WhenCallingBuildImplicitly_ShouldOverrideValues()
public void GivenBuilderWithModifications_WhenCallingBuildImplicitly_ThenOverrideValues()
{
StudentViewModel vm = Builder<StudentViewModel>.CreateNew()
.Set(x => x.FirstName, "Pi")
Expand All @@ -57,7 +58,7 @@ public void GivenBuilderWithModifications_WhenCallingBuildImplicitly_ShouldOverr
}

[Fact]
public void GivenBuilder_WhenBuildingObjectWithCtorAndPrivateSetters_ShouldSetPrivateSettersByDefault()
public void GivenBuilder_WhenBuildingObjectWithCtorAndPrivateSetters_ThenSetPrivateSettersByDefault()
{
MixedAccessibilityDto dto = Builder<MixedAccessibilityDto>.CreateNew()
.Set(x => x.SetByCtorWithPublicSetter, "1")
Expand All @@ -72,7 +73,7 @@ public void GivenBuilder_WhenBuildingObjectWithCtorAndPrivateSetters_ShouldSetPr
}

[Fact]
public void GivenBuilderWithFactoryOverride_WhenBuildingObject_ShouldRespectOverriddenFactory()
public void GivenBuilderWithFactoryOverride_WhenBuildingObject_ThenRespectOverriddenFactory()
{
MixedAccessibilityDto dto = Builder<MixedAccessibilityDto>.CreateNew(new CallConstructorFactory())
.Set(x => x.SetByCtorWithPublicSetter, "1")
Expand All @@ -85,5 +86,21 @@ public void GivenBuilderWithFactoryOverride_WhenBuildingObject_ShouldRespectOver
dto.NotSetByCtorWithPrivateSetter.ShouldNotBe("3");
dto.NotSetByCtorWithPublicSetter.ShouldNotBe("4");
}

[Fact]
public void GivenBuilder_WhenCallingSetWithLambda_ThenInvokeEachTime()
{
var grade = Grade.A;
var builder = Builder<StudentViewModel>.CreateNew()
.Set(x => x.FirstName, "Pi")
.Set(x => x.LastName, "Lanningham")
.Set(x => x.Grade, () => grade++);

var customerA = builder.Build();
var customerB = builder.Build();

customerA.Grade.ShouldBe(Grade.A);
customerB.Grade.ShouldBe(Grade.B);
}
}
}

0 comments on commit 3d53abb

Please sign in to comment.