Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jbandi
committed
Mar 13, 2010
0 parents
commit f678034
Showing
40 changed files
with
2,693 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
*.vspscc | ||
*.vssscc | ||
*.user | ||
*.suo | ||
Thumbs.db | ||
obj/ | ||
[Bb]in/ | ||
[Dd]ebug*/ | ||
[Rr]elease*/ | ||
_ReSharper*/ | ||
[Tt]est[Rr]esult* |
10 changes: 10 additions & 0 deletions
10
BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/App.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/> | ||
</configSections> | ||
|
||
<specFlow> | ||
<unitTestProvider name="MsTest" /> | ||
</specFlow> | ||
</configuration> |
83 changes: 83 additions & 0 deletions
83
BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/Bowling.SpecFlow.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>9.0.30729</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{04D53AE6-D834-434F-8A29-2A4D8787F581}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Bowling.SpecFlow</RootNamespace> | ||
<AssemblyName>Bowling.SpecFlow</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="TechTalk.SpecFlow, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>C:\Program Files\TechTalk\SpecFlow\TechTalk.SpecFlow.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="BowlingSteps.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="ScoreCalculation.feature.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>ScoreCalculation.feature</DependentUpon> | ||
</Compile> | ||
<Compile Include="ScoreCalculationAlternatives.feature.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>ScoreCalculationAlternatives.feature</DependentUpon> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="ScoreCalculation.feature"> | ||
<Generator>SpecFlowSingleFileGenerator</Generator> | ||
<LastGenOutput>ScoreCalculation.feature.cs</LastGenOutput> | ||
</None> | ||
<None Include="ScoreCalculationAlternatives.feature"> | ||
<Generator>SpecFlowSingleFileGenerator</Generator> | ||
<LastGenOutput>ScoreCalculationAlternatives.feature.cs</LastGenOutput> | ||
</None> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Bowling\Bowling.csproj"> | ||
<Project>{B065A18E-57BD-4399-AAF7-BD2FA0147FCB}</Project> | ||
<Name>Bowling</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
92 changes: 92 additions & 0 deletions
92
BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/BowlingSteps.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using TechTalk.SpecFlow; | ||
|
||
namespace Bowling.Specflow | ||
{ | ||
[Binding] | ||
public class BowlingSteps | ||
{ | ||
private Game _game; | ||
|
||
[Given(@"a new bowling game")] | ||
public void GivenANewBowlingGame() | ||
{ | ||
_game = new Game(); | ||
} | ||
|
||
[When(@"all of my balls are landing in the gutter")] | ||
public void WhenAllOfMyBallsAreLandingInTheGutter() | ||
{ | ||
for (int i = 0; i < 20; i++) | ||
{ | ||
_game.Roll(0); | ||
} | ||
} | ||
|
||
[When(@"all of my rolls are strikes")] | ||
public void WhenAllOfMyRollsAreStrikes() | ||
{ | ||
for (int i = 0; i < 12; i++) | ||
{ | ||
_game.Roll(10); | ||
} | ||
} | ||
|
||
[Then(@"my total score should be (\d+)")] | ||
public void ThenMyTotalScoreShouldBe(int score) | ||
{ | ||
Assert.AreEqual(score, _game.Score); | ||
} | ||
|
||
[When(@"I roll (\d+)")] | ||
public void WhenIRoll(int pins) | ||
{ | ||
_game.Roll(pins); | ||
} | ||
|
||
[When(@"I roll (\d+) and (\d+)")] | ||
public void WhenIRoll(int pins1, int pins2) | ||
{ | ||
_game.Roll(pins1); | ||
_game.Roll(pins2); | ||
} | ||
|
||
// [When(@"(\d+) times I roll (\d+) and (\d+)")] | ||
// public void WhenIRollSeveralTimes(int rollCount, int pins1, int pins2) | ||
// { | ||
// for (int i = 0; i < rollCount; i++) | ||
// { | ||
// _game.Roll(pins1); | ||
// _game.Roll(pins2); | ||
// } | ||
// } | ||
|
||
[When(@"I roll (\d+) times (\d+) and (\d+)")] | ||
public void WhenIRollSeveralTimes2(int rollCount, int pins1, int pins2) | ||
{ | ||
for (int i = 0; i < rollCount; i++) | ||
{ | ||
_game.Roll(pins1); | ||
_game.Roll(pins2); | ||
} | ||
} | ||
|
||
[When(@"I roll the following series:(.*)")] | ||
public void WhenIRollTheFollowingSeries(string series) | ||
{ | ||
foreach (var roll in series.Trim().Split(',')) | ||
{ | ||
_game.Roll(int.Parse(roll)); | ||
} | ||
} | ||
|
||
[When(@"I roll")] | ||
public void WhenIRoll(Table rolls) | ||
{ | ||
foreach (var row in rolls.Rows) | ||
{ | ||
_game.Roll(int.Parse(row["Pins"])); | ||
} | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Bowling.SpecFlow")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Bowling.SpecFlow")] | ||
[assembly: AssemblyCopyright("Copyright © 2009")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM componenets. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("01e9aaa1-56e3-4cf9-9800-95ecdbd23963")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Revision and Build Numbers | ||
// by using the '*' as shown below: | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
38 changes: 38 additions & 0 deletions
38
BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculation.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Feature: Score Calculation | ||
In order to know my performance | ||
As a player | ||
I want the system to calculate my total score | ||
|
||
Scenario: Gutter game | ||
Given a new bowling game | ||
When all of my balls are landing in the gutter | ||
Then my total score should be 0 | ||
|
||
Scenario: Beginners game | ||
Given a new bowling game | ||
When I roll 2 and 7 | ||
And I roll 3 and 4 | ||
And I roll 8 times 1 and 1 | ||
Then my total score should be 32 | ||
|
||
Scenario: Another beginners game | ||
Given a new bowling game | ||
When I roll the following series: 2,7,3,4,1,1,5,1,1,1,1,1,1,1,1,1,1,1,5,1 | ||
Then my total score should be 40 | ||
|
||
Scenario: All Strikes | ||
Given a new bowling game | ||
When all of my rolls are strikes | ||
Then my total score should be 300 | ||
|
||
Scenario: One single spare | ||
Given a new bowling game | ||
When I roll the following series: 2,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 | ||
Then my total score should be 29 | ||
|
||
Scenario: All spares | ||
Given a new bowling game | ||
When I roll 10 times 1 and 9 | ||
And I roll 1 | ||
Then my total score should be 110 | ||
|
Oops, something went wrong.