Skip to content

Commit

Permalink
Merge pull request #63 from TestStack/get-builders
Browse files Browse the repository at this point in the history
Added ListBuilder.GetBuiders method
  • Loading branch information
robdmoore authored Jan 8, 2017
2 parents b0fda3d + 2615a97 commit 8afa6a1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GitVersionConfig.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mode: ContinuousDelivery
next-version: 3.3.0
next-version: 3.4.0
branches: {}
14 changes: 14 additions & 0 deletions TestStack.Dossier.Tests/BuildListTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,19 @@ public void GivenBuilderWithSetCallsInConstructor_WhenBuildingAListOfTheBuilders
customers[2].FirstName.ShouldBe(BuilderWithDefaults.DefaultFirstName);
customers[2].LastName.ShouldBe(BuilderWithDefaults.DefaultLastName);
}

[Fact]
public void GivenListOfBuilders_WhenCallingGetBuilders_ThenTheListOfBuildersShouldBeReturned()
{
var list = BasicCustomerBuilder.CreateListOfSize(5);

var builders = list.GetBuilders();

builders.ShouldSatisfyAllConditions(
() => builders.ShouldBeAssignableTo<IEnumerable<BasicCustomerBuilder>>(),
() => builders.Count().ShouldBe(5),
() => builders.All(b => b != null),
() => builders.ShouldBeUnique());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ namespace TestStack.Dossier.Lists
{
public TBuilder All() { }
public System.Collections.Generic.IList<TObject> BuildList() { }
public System.Collections.Generic.IEnumerable<TBuilder> GetBuilders() { }
public TBuilder TheFirst(int howMany) { }
public TBuilder TheLast(int howMany) { }
public TBuilder TheNext(int howMany) { }
Expand Down
6 changes: 3 additions & 3 deletions TestStack.Dossier.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 15
VisualStudioVersion = 15.0.26014.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BC8508D1-6FCB-46B2-9C14-F41F6AD76B09}"
ProjectSection(SolutionItems) = preProject
BREAKING_CHANGES.md = BREAKING_CHANGES.md
CONTRIBUTING.md = CONTRIBUTING.md
GitVersionConfig.yaml = GitVersionConfig.yaml
LICENSE = LICENSE
logo.png = logo.png
NextVersion.txt = NextVersion.txt
README.md = README.md
EndProjectSection
EndProject
Expand Down
9 changes: 9 additions & 0 deletions TestStack.Dossier/Lists/ListBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ public IList<TObject> BuildList()
return _list.Select(b => b.Build()).ToArray();
}

/// <summary>
/// Return the list of builder objects.
/// </summary>
/// <returns>The list of builder objects</returns>
public IEnumerable<TBuilder> GetBuilders()
{
return _list.AsReadOnly();
}

/// <summary>
/// Builds the list of objects with implicit conversion operator.
/// </summary>
Expand Down

0 comments on commit 8afa6a1

Please sign in to comment.