ewilde / crane

Crane creates builds scripts so you don't have to
http://blog.cranebuild.com
Apache License 2.0
6 stars 2 forks source link

[testing] builder pattern for 'given' test state #98

Open kevholditch opened 9 years ago

kevholditch commented 9 years ago

Abstract the building of the test setup (context) behind a builder. So we can reuse the steps across multiple tests

Given.IHaveCrane
.And.IHaveGit
.And.IHaveCreatedTheSolution(b => b.WithSolution(solution => solution.Path = Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack", "ServiceStack.sln"))
                        .WithFile(text => AddSolutionPackagesConfigWithXUnitRunner(text, Path.Combine(craneTestContext.BuildOutputDirectory, "ServiceStack", ".nuget", "packages.config")))
                        .WithProject(project => project.Name = "ServiceStack.Core")
                        .Build())
.And.IHaveCreatedACommit("my first commit")