diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..3bf06da5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+
+*.vspscc
+*.vssscc
+*.user
+*.suo
+Thumbs.db
+obj/
+[Bb]in/
+[Dd]ebug*/
+[Rr]elease*/
+_ReSharper*/
+[Tt]est[Rr]esult*
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/App.config b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/App.config
new file mode 100644
index 00000000..ebef0255
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/App.config
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/Bowling.SpecFlow.csproj b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/Bowling.SpecFlow.csproj
new file mode 100644
index 00000000..5e46d5b8
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/Bowling.SpecFlow.csproj
@@ -0,0 +1,83 @@
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {04D53AE6-D834-434F-8A29-2A4D8787F581}
+ Library
+ Properties
+ Bowling.SpecFlow
+ Bowling.SpecFlow
+ v3.5
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+ 3.5
+
+
+ False
+ C:\Program Files\TechTalk\SpecFlow\TechTalk.SpecFlow.dll
+
+
+
+
+
+
+ True
+ True
+ ScoreCalculation.feature
+
+
+ True
+ True
+ ScoreCalculationAlternatives.feature
+
+
+
+
+
+ SpecFlowSingleFileGenerator
+ ScoreCalculation.feature.cs
+
+
+ SpecFlowSingleFileGenerator
+ ScoreCalculationAlternatives.feature.cs
+
+
+
+
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}
+ Bowling
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/BowlingSteps.cs b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/BowlingSteps.cs
new file mode 100644
index 00000000..96c4ea4a
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/BowlingSteps.cs
@@ -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"]));
+ }
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/Properties/AssemblyInfo.cs b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..581bb000
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/Properties/AssemblyInfo.cs
@@ -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")]
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculation.feature b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculation.feature
new file mode 100644
index 00000000..8b65aee9
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculation.feature
@@ -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
+
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculation.feature.cs b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculation.feature.cs
new file mode 100644
index 00000000..493f1bdc
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculation.feature.cs
@@ -0,0 +1,166 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.1.0.0
+// Runtime Version:2.0.50727.4918
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+namespace Bowling.SpecFlow
+{
+ using TechTalk.SpecFlow;
+
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute()]
+ public partial class ScoreCalculationFeature
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "ScoreCalculation.feature"
+#line hidden
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()]
+ public static void FeatureSetup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en"), "Score Calculation", "In order to know my performance\r\nAs a player\r\nI want the system to calculate my t" +
+ "otal score", ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute()]
+ public static void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestCleanupAttribute()]
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Gutter game")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation")]
+ public virtual void GutterGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Gutter game", ((string[])(null)));
+#line 6
+this.ScenarioSetup(scenarioInfo);
+#line 7
+ testRunner.Given("a new bowling game");
+#line 8
+ testRunner.When("all of my balls are landing in the gutter");
+#line 9
+ testRunner.Then("my total score should be 0");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Beginners game")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation")]
+ public virtual void BeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Beginners game", ((string[])(null)));
+#line 11
+this.ScenarioSetup(scenarioInfo);
+#line 12
+ testRunner.Given("a new bowling game");
+#line 13
+ testRunner.When("I roll 2 and 7");
+#line 14
+ testRunner.And("I roll 3 and 4");
+#line 15
+ testRunner.And("I roll 8 times 1 and 1");
+#line 16
+ testRunner.Then("my total score should be 32");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Another beginners game")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation")]
+ public virtual void AnotherBeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Another beginners game", ((string[])(null)));
+#line 18
+this.ScenarioSetup(scenarioInfo);
+#line 19
+ testRunner.Given("a new bowling game");
+#line 20
+ testRunner.When("I roll the following series:\t2,7,3,4,1,1,5,1,1,1,1,1,1,1,1,1,1,1,5,1");
+#line 21
+ testRunner.Then("my total score should be 40");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("All Strikes")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation")]
+ public virtual void AllStrikes()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All Strikes", ((string[])(null)));
+#line 23
+this.ScenarioSetup(scenarioInfo);
+#line 24
+ testRunner.Given("a new bowling game");
+#line 25
+ testRunner.When("all of my rolls are strikes");
+#line 26
+ testRunner.Then("my total score should be 300");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("One single spare")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation")]
+ public virtual void OneSingleSpare()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("One single spare", ((string[])(null)));
+#line 28
+this.ScenarioSetup(scenarioInfo);
+#line 29
+ testRunner.Given("a new bowling game");
+#line 30
+ testRunner.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");
+#line 31
+ testRunner.Then("my total score should be 29");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("All spares")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation")]
+ public virtual void AllSpares()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All spares", ((string[])(null)));
+#line 33
+this.ScenarioSetup(scenarioInfo);
+#line 34
+ testRunner.Given("a new bowling game");
+#line 35
+ testRunner.When("I roll 10 times 1 and 9");
+#line 36
+ testRunner.And("I roll 1");
+#line 37
+ testRunner.Then("my total score should be 110");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculationAlternatives.feature b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculationAlternatives.feature
new file mode 100644
index 00000000..da991dd8
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculationAlternatives.feature
@@ -0,0 +1,43 @@
+Feature: Score Calculation (alternative forms)
+ In order to know my performance
+ As a player
+ I want the system to calculate my total score
+
+
+Scenario: One single spare
+ Given a new bowling game
+ When I roll the following series: 3,7,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
+
+Scenario: Yet another beginners game
+ Given a new bowling game
+ When I roll
+ | Pins |
+ | 2 |
+ | 7 |
+ | 1 |
+ | 5 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 3 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 4 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 8 |
+ | 1 |
+ | 1 |
+ | 1 |
+ Then my total score should be 43
+
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculationAlternatives.feature.cs b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculationAlternatives.feature.cs
new file mode 100644
index 00000000..e221ca55
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.SpecFlow/ScoreCalculationAlternatives.feature.cs
@@ -0,0 +1,151 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.1.0.0
+// Runtime Version:2.0.50727.4918
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+namespace Bowling.SpecFlow
+{
+ using TechTalk.SpecFlow;
+
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute()]
+ public partial class ScoreCalculationAlternativeFormsFeature
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "ScoreCalculationAlternatives.feature"
+#line hidden
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()]
+ public static void FeatureSetup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en"), "Score Calculation (alternative forms)", "In order to know my performance\r\nAs a player\r\nI want the system to calculate my t" +
+ "otal score", ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute()]
+ public static void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestCleanupAttribute()]
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("One single spare")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation (alternative forms)")]
+ public virtual void OneSingleSpare()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("One single spare", ((string[])(null)));
+#line 7
+this.ScenarioSetup(scenarioInfo);
+#line 8
+ testRunner.Given("a new bowling game");
+#line 9
+ testRunner.When("I roll the following series:\t3,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1");
+#line 10
+ testRunner.Then("my total score should be 29");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("All spares")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation (alternative forms)")]
+ public virtual void AllSpares()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All spares", ((string[])(null)));
+#line 12
+this.ScenarioSetup(scenarioInfo);
+#line 13
+ testRunner.Given("a new bowling game");
+#line 14
+ testRunner.When("I roll 10 times 1 and 9");
+#line 15
+ testRunner.And("I roll 1");
+#line 16
+ testRunner.Then("my total score should be 110");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Yet another beginners game")]
+ [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Score Calculation (alternative forms)")]
+ public virtual void YetAnotherBeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Yet another beginners game", ((string[])(null)));
+#line 18
+this.ScenarioSetup(scenarioInfo);
+#line 19
+ testRunner.Given("a new bowling game");
+#line hidden
+ TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
+ "Pins"});
+ table1.AddRow(new string[] {
+ "2"});
+ table1.AddRow(new string[] {
+ "7"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "5"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "3"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "4"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "8"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+#line 20
+ testRunner.When("I roll", ((string)(null)), table1);
+#line 42
+ testRunner.Then("my total score should be 43");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.sln b/BowlingKata/BowlingKata-MsTest/Bowling.sln
new file mode 100644
index 00000000..28d8d669
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.sln
@@ -0,0 +1,35 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling", "Bowling\Bowling.csproj", "{B065A18E-57BD-4399-AAF7-BD2FA0147FCB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling.SpecFlow", "Bowling.SpecFlow\Bowling.SpecFlow.csproj", "{04D53AE6-D834-434F-8A29-2A4D8787F581}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{85430265-759B-4CA9-B2BA-CBD9CB670274}"
+ ProjectSection(SolutionItems) = preProject
+ Bowling.vsmdi = Bowling.vsmdi
+ LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(TestCaseManagementSettings) = postSolution
+ CategoryFile = Bowling.vsmdi
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {04D53AE6-D834-434F-8A29-2A4D8787F581}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {04D53AE6-D834-434F-8A29-2A4D8787F581}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {04D53AE6-D834-434F-8A29-2A4D8787F581}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {04D53AE6-D834-434F-8A29-2A4D8787F581}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling.vsmdi b/BowlingKata/BowlingKata-MsTest/Bowling.vsmdi
new file mode 100644
index 00000000..9562b681
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling.vsmdi
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling/Bowling.csproj b/BowlingKata/BowlingKata-MsTest/Bowling/Bowling.csproj
new file mode 100644
index 00000000..224516dd
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling/Bowling.csproj
@@ -0,0 +1,59 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}
+ Library
+ Properties
+ Bowling
+ Bowling
+ v3.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling/Game.cs b/BowlingKata/BowlingKata-MsTest/Bowling/Game.cs
new file mode 100644
index 00000000..b3238058
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling/Game.cs
@@ -0,0 +1,67 @@
+namespace Bowling
+{
+ public class Game
+ {
+ private int[] rolls = new int[21];
+ private int currentRoll;
+
+ public void Roll(int pins)
+ {
+ rolls[currentRoll++] = pins;
+ }
+
+ public int Score
+ {
+ get
+ {
+ int score = 0;
+ int frameIndex = 0;
+ for (int frame = 0; frame < 10; frame++)
+ {
+ if (isStrike(frameIndex))
+ {
+ score += 10 + strikeBonus(frameIndex);
+ frameIndex++;
+ }
+ else if (isSpare(frameIndex))
+ {
+ score += 10 + spareBonus(frameIndex);
+ frameIndex += 2;
+ }
+ else
+ {
+ score += sumOfBallsInFrame(frameIndex);
+ frameIndex += 2;
+ }
+ }
+ return score;
+ }
+ }
+
+ private bool isStrike(int frameIndex)
+ {
+ return rolls[frameIndex] == 10;
+ }
+
+ private int sumOfBallsInFrame(int frameIndex)
+ {
+ return rolls[frameIndex] + rolls[frameIndex + 1];
+ }
+
+ private int spareBonus(int frameIndex)
+ {
+ return rolls[frameIndex + 2];
+ }
+
+ private int strikeBonus(int frameIndex)
+ {
+ return rolls[frameIndex + 1] + rolls[frameIndex + 2];
+ }
+
+ private bool isSpare(int frameIndex)
+ {
+ return rolls[frameIndex] + rolls[frameIndex + 1] == 10;
+ }
+
+ }
+}
diff --git a/BowlingKata/BowlingKata-MsTest/Bowling/Properties/AssemblyInfo.cs b/BowlingKata/BowlingKata-MsTest/Bowling/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..638bab22
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/Bowling/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+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")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Bowling")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. 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("7e637ff2-1f70-4d59-bedf-78202aeae595")]
+
+// 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 Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/BowlingKata/BowlingKata-MsTest/LocalTestRun.testrunconfig b/BowlingKata/BowlingKata-MsTest/LocalTestRun.testrunconfig
new file mode 100644
index 00000000..1f5f907f
--- /dev/null
+++ b/BowlingKata/BowlingKata-MsTest/LocalTestRun.testrunconfig
@@ -0,0 +1,5 @@
+
+
+ This is a default test run configuration for a local test run.
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/App.config b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/App.config
new file mode 100644
index 00000000..71ca59bd
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/App.config
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/Bowling.Specflow.csproj b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/Bowling.Specflow.csproj
new file mode 100644
index 00000000..e4ed965c
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/Bowling.Specflow.csproj
@@ -0,0 +1,94 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}
+ Library
+ Properties
+ Bowling.Specflow
+ Bowling.Specflow
+ v3.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ False
+ ..\..\..\lib\nunit\nunit.framework.dll
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+ False
+ C:\Program Files\TechTalk\SpecFlow\TechTalk.SpecFlow.dll
+
+
+
+
+
+
+ True
+ True
+ ScoreCalculation.feature
+
+
+ True
+ True
+ ScoreCalculationAlternatives.feature
+
+
+
+
+
+ SpecFlowSingleFileGenerator
+ ScoreCalculation.feature.cs
+
+
+ SpecFlowSingleFileGenerator
+ ScoreCalculationAlternatives.feature.cs
+
+
+
+
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}
+ Bowling
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/BowlingSteps.cs b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/BowlingSteps.cs
new file mode 100644
index 00000000..87e1e73c
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/BowlingSteps.cs
@@ -0,0 +1,93 @@
+
+using NUnit.Framework;
+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"]));
+ }
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/Properties/AssemblyInfo.cs b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..62c82185
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+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("Microsoft")]
+[assembly: AssemblyProduct("Bowling.Specflow")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. 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("999efa28-8498-4b70-a80d-979fbd7b840e")]
+
+// 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 Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature
new file mode 100644
index 00000000..8b65aee9
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature
@@ -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
+
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature.cs b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature.cs
new file mode 100644
index 00000000..92f46737
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature.cs
@@ -0,0 +1,188 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.1.0.0
+// Runtime Version:2.0.50727.4918
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+namespace Bowling.Specflow
+{
+ using TechTalk.SpecFlow;
+
+
+ [NUnit.Framework.TestFixtureAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Score Calculation")]
+ public partial class ScoreCalculationFeature
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "ScoreCalculation.feature"
+#line hidden
+
+ [NUnit.Framework.TestFixtureSetUpAttribute()]
+ public virtual void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en"), "Score Calculation", "In order to know my performance\r\nAs a player\r\nI want the system to calculate my t" +
+ "otal score", ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ [NUnit.Framework.TestFixtureTearDownAttribute()]
+ public virtual void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ [NUnit.Framework.TearDownAttribute()]
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Gutter game")]
+ public virtual void GutterGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Gutter game", ((string[])(null)));
+#line 6
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 7
+//#indentnext 2
+ testRunner.Given("a new bowling game");
+#line 8
+//#indentnext 2
+ testRunner.When("all of my balls are landing in the gutter");
+#line 9
+//#indentnext 2
+ testRunner.Then("my total score should be 0");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Beginners game")]
+ public virtual void BeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Beginners game", ((string[])(null)));
+#line 11
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 12
+//#indentnext 2
+ testRunner.Given("a new bowling game");
+#line 13
+//#indentnext 2
+ testRunner.When("I roll 2 and 7");
+#line 14
+//#indentnext 2
+ testRunner.And("I roll 3 and 4");
+#line 15
+//#indentnext 2
+ testRunner.And("I roll 8 times 1 and 1");
+#line 16
+//#indentnext 2
+ testRunner.Then("my total score should be 32");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Another beginners game")]
+ public virtual void AnotherBeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Another beginners game", ((string[])(null)));
+#line 18
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 19
+//#indentnext 2
+ testRunner.Given("a new bowling game");
+#line 20
+//#indentnext 2
+ testRunner.When("I roll the following series:\t2,7,3,4,1,1,5,1,1,1,1,1,1,1,1,1,1,1,5,1");
+#line 21
+//#indentnext 2
+ testRunner.Then("my total score should be 40");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("All Strikes")]
+ public virtual void AllStrikes()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All Strikes", ((string[])(null)));
+#line 23
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 24
+//#indentnext 2
+ testRunner.Given("a new bowling game");
+#line 25
+//#indentnext 2
+ testRunner.When("all of my rolls are strikes");
+#line 26
+//#indentnext 2
+ testRunner.Then("my total score should be 300");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("One single spare")]
+ public virtual void OneSingleSpare()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("One single spare", ((string[])(null)));
+#line 28
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 29
+//#indentnext 3
+ testRunner.Given("a new bowling game");
+#line 30
+//#indentnext 3
+ testRunner.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");
+#line 31
+//#indentnext 3
+ testRunner.Then("my total score should be 29");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("All spares")]
+ public virtual void AllSpares()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All spares", ((string[])(null)));
+#line 33
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 34
+//#indentnext 2
+ testRunner.Given("a new bowling game");
+#line 35
+//#indentnext 2
+ testRunner.When("I roll 10 times 1 and 9");
+#line 36
+//#indentnext 2
+ testRunner.And("I roll 1");
+#line 37
+//#indentnext 2
+ testRunner.Then("my total score should be 110");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature.cs.bup b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature.cs.bup
new file mode 100644
index 00000000..a051810c
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculation.feature.cs.bup
@@ -0,0 +1,125 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Bowling.Specflow
+{
+ using TechTalk.SpecFlow;
+
+
+ [NUnit.Framework.TestFixtureAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Score Calculation")]
+ public partial class ScoreCalculationFeature
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+ [NUnit.Framework.TestFixtureSetUpAttribute()]
+ public virtual void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en"), "Score Calculation", "In order to know my performance\r\nAs a player\r\nI want the system to calculate my t" +
+ "otal score", ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ [NUnit.Framework.TestFixtureTearDownAttribute()]
+ public virtual void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ [NUnit.Framework.TearDownAttribute()]
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Gütter game")]
+ public virtual void GutterGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Gütter game", ((string[])(null)));
+ this.ScenarioSetup(scenarioInfo);
+ testRunner.Given("a new bowling game");
+ testRunner.When("all of my balls are landing in the gutter");
+ testRunner.Then("my total score should be 0");
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Beginners game")]
+ public virtual void BeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Beginners game", ((string[])(null)));
+ this.ScenarioSetup(scenarioInfo);
+ testRunner.Given("a new bowling game");
+ testRunner.When("I roll 2 and 7");
+ testRunner.And("I roll 3 and 4");
+ testRunner.And("I roll 8 times 1 and 1");
+ testRunner.Then("my total score should be 32");
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Another beginners game")]
+ public virtual void AnotherBeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Another beginners game", ((string[])(null)));
+ this.ScenarioSetup(scenarioInfo);
+ testRunner.Given("a new bowling game");
+ testRunner.When("I roll the following series:\t2,7,3,4,1,1,5,1,1,1,1,1,1,1,1,1,1,1,5,1");
+ testRunner.Then("my total score should be 40");
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("All Strikes")]
+ public virtual void AllStrikes()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All Strikes", ((string[])(null)));
+ this.ScenarioSetup(scenarioInfo);
+ testRunner.Given("a new bowling game");
+ testRunner.When("all of my rolls are strikes");
+ testRunner.Then("my total score should be 300");
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("One single spare")]
+ public virtual void OneSingleSpare()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("One single spare", ((string[])(null)));
+ this.ScenarioSetup(scenarioInfo);
+ testRunner.Given("a new bowling game");
+ testRunner.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");
+ testRunner.Then("my total score should be 29");
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("All spares")]
+ public virtual void AllSpares()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All spares", ((string[])(null)));
+ this.ScenarioSetup(scenarioInfo);
+ testRunner.Given("a new bowling game");
+ testRunner.When("I roll 10 times 1 and 9");
+ testRunner.And("I roll 1");
+ testRunner.Then("my total score should be 110");
+ testRunner.CollectScenarioErrors();
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculationAlternatives.feature b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculationAlternatives.feature
new file mode 100644
index 00000000..da991dd8
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculationAlternatives.feature
@@ -0,0 +1,43 @@
+Feature: Score Calculation (alternative forms)
+ In order to know my performance
+ As a player
+ I want the system to calculate my total score
+
+
+Scenario: One single spare
+ Given a new bowling game
+ When I roll the following series: 3,7,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
+
+Scenario: Yet another beginners game
+ Given a new bowling game
+ When I roll
+ | Pins |
+ | 2 |
+ | 7 |
+ | 1 |
+ | 5 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 3 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 4 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 8 |
+ | 1 |
+ | 1 |
+ | 1 |
+ Then my total score should be 43
+
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculationAlternatives.feature.cs b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculationAlternatives.feature.cs
new file mode 100644
index 00000000..cc45c189
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.Specflow/ScoreCalculationAlternatives.feature.cs
@@ -0,0 +1,162 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.1.0.0
+// Runtime Version:2.0.50727.4918
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+namespace Bowling.Specflow
+{
+ using TechTalk.SpecFlow;
+
+
+ [NUnit.Framework.TestFixtureAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Score Calculation (alternative forms)")]
+ public partial class ScoreCalculationAlternativeFormsFeature
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "ScoreCalculationAlternatives.feature"
+#line hidden
+
+ [NUnit.Framework.TestFixtureSetUpAttribute()]
+ public virtual void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en"), "Score Calculation (alternative forms)", "In order to know my performance\r\nAs a player\r\nI want the system to calculate my t" +
+ "otal score", ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ [NUnit.Framework.TestFixtureTearDownAttribute()]
+ public virtual void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ [NUnit.Framework.TearDownAttribute()]
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("One single spare")]
+ public virtual void OneSingleSpare()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("One single spare", ((string[])(null)));
+#line 7
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 8
+//#indentnext 2
+ testRunner.Given("a new bowling game");
+#line 9
+//#indentnext 2
+ testRunner.When("I roll the following series:\t3,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1");
+#line 10
+//#indentnext 2
+ testRunner.Then("my total score should be 29");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("All spares")]
+ public virtual void AllSpares()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All spares", ((string[])(null)));
+#line 12
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 13
+//#indentnext 2
+ testRunner.Given("a new bowling game");
+#line 14
+//#indentnext 2
+ testRunner.When("I roll 10 times 1 and 9");
+#line 15
+//#indentnext 2
+ testRunner.And("I roll 1");
+#line 16
+//#indentnext 2
+ testRunner.Then("my total score should be 110");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("Yet another beginners game")]
+ public virtual void YetAnotherBeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Yet another beginners game", ((string[])(null)));
+#line 18
+//#indentnext 0
+ this.ScenarioSetup(scenarioInfo);
+#line 19
+//#indentnext 2
+ testRunner.Given("a new bowling game");
+#line hidden
+ TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
+ "Pins"});
+ table1.AddRow(new string[] {
+ "2"});
+ table1.AddRow(new string[] {
+ "7"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "5"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "3"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "4"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "8"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+#line 20
+//#indentnext 2
+ testRunner.When("I roll", ((string)(null)), table1);
+#line 42
+//#indentnext 2
+ testRunner.Then("my total score should be 43");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling.sln b/BowlingKata/BowlingKata-Nunit/Bowling.sln
new file mode 100644
index 00000000..2bd90eb9
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling", "Bowling\Bowling.csproj", "{B065A18E-57BD-4399-AAF7-BD2FA0147FCB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling.Specflow", "Bowling.Specflow\Bowling.Specflow.csproj", "{D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling/Bowling.csproj b/BowlingKata/BowlingKata-Nunit/Bowling/Bowling.csproj
new file mode 100644
index 00000000..224516dd
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling/Bowling.csproj
@@ -0,0 +1,59 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}
+ Library
+ Properties
+ Bowling
+ Bowling
+ v3.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling/Game.cs b/BowlingKata/BowlingKata-Nunit/Bowling/Game.cs
new file mode 100644
index 00000000..b3238058
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling/Game.cs
@@ -0,0 +1,67 @@
+namespace Bowling
+{
+ public class Game
+ {
+ private int[] rolls = new int[21];
+ private int currentRoll;
+
+ public void Roll(int pins)
+ {
+ rolls[currentRoll++] = pins;
+ }
+
+ public int Score
+ {
+ get
+ {
+ int score = 0;
+ int frameIndex = 0;
+ for (int frame = 0; frame < 10; frame++)
+ {
+ if (isStrike(frameIndex))
+ {
+ score += 10 + strikeBonus(frameIndex);
+ frameIndex++;
+ }
+ else if (isSpare(frameIndex))
+ {
+ score += 10 + spareBonus(frameIndex);
+ frameIndex += 2;
+ }
+ else
+ {
+ score += sumOfBallsInFrame(frameIndex);
+ frameIndex += 2;
+ }
+ }
+ return score;
+ }
+ }
+
+ private bool isStrike(int frameIndex)
+ {
+ return rolls[frameIndex] == 10;
+ }
+
+ private int sumOfBallsInFrame(int frameIndex)
+ {
+ return rolls[frameIndex] + rolls[frameIndex + 1];
+ }
+
+ private int spareBonus(int frameIndex)
+ {
+ return rolls[frameIndex + 2];
+ }
+
+ private int strikeBonus(int frameIndex)
+ {
+ return rolls[frameIndex + 1] + rolls[frameIndex + 2];
+ }
+
+ private bool isSpare(int frameIndex)
+ {
+ return rolls[frameIndex] + rolls[frameIndex + 1] == 10;
+ }
+
+ }
+}
diff --git a/BowlingKata/BowlingKata-Nunit/Bowling/Properties/AssemblyInfo.cs b/BowlingKata/BowlingKata-Nunit/Bowling/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..638bab22
--- /dev/null
+++ b/BowlingKata/BowlingKata-Nunit/Bowling/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+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")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Bowling")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. 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("7e637ff2-1f70-4d59-bedf-78202aeae595")]
+
+// 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 Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Bowling.Specflow.csproj b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Bowling.Specflow.csproj
new file mode 100644
index 00000000..4970a67e
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Bowling.Specflow.csproj
@@ -0,0 +1,95 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}
+ Library
+ Properties
+ Bowling.Specflow
+ Bowling.Specflow
+ v3.5
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+ False
+ ..\..\..\Runtime\bin\Debug\TechTalk.SpecFlow.dll
+
+
+ False
+ ..\..\..\..\..\Program Files (x86)\xUnit.net 1.5\xunit.dll
+
+
+
+
+
+
+ True
+ True
+ ScoreCalculationAlternativesFeature.feature
+
+
+ True
+ True
+ ScoreCalculationFeature.feature
+
+
+
+
+
+ SpecFlowSingleFileGenerator
+ ScoreCalculationAlternativesFeature.feature.cs
+
+
+ SpecFlowSingleFileGenerator
+ ScoreCalculationFeature.feature.cs
+
+
+
+
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}
+ Bowling
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/BowlingSteps.cs b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/BowlingSteps.cs
new file mode 100644
index 00000000..fe96da35
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/BowlingSteps.cs
@@ -0,0 +1,93 @@
+
+using Xunit;
+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.Equal(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"]));
+ }
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Properties/App.config b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Properties/App.config
new file mode 100644
index 00000000..56a45d06
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Properties/App.config
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Properties/AssemblyInfo.cs b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..62c82185
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+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("Microsoft")]
+[assembly: AssemblyProduct("Bowling.Specflow")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. 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("999efa28-8498-4b70-a80d-979fbd7b840e")]
+
+// 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 Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationAlternativesFeature.feature b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationAlternativesFeature.feature
new file mode 100644
index 00000000..2fb99cc0
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationAlternativesFeature.feature
@@ -0,0 +1,42 @@
+Feature: Score Calculation (alternative forms)
+ In order to know my performance
+ As a player
+ I want the system to calculate my total score
+
+
+Scenario: One single spare
+ Given a new bowling game
+ When I roll the following series: 3,7,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
+
+Scenario: Yet another beginners game
+ Given a new bowling game
+ When I roll
+ | Pins |
+ | 2 |
+ | 7 |
+ | 1 |
+ | 5 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 3 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 4 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 1 |
+ | 8 |
+ | 1 |
+ | 1 |
+ | 1 |
+ Then my total score should be 43
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationAlternativesFeature.feature.cs b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationAlternativesFeature.feature.cs
new file mode 100644
index 00000000..f2d4baf9
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationAlternativesFeature.feature.cs
@@ -0,0 +1,170 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.2.0.0
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+namespace Bowling.Specflow
+{
+ using TechTalk.SpecFlow;
+
+
+ public partial class ScoreCalculationAlternativeFormsFeature : Xunit.IUseFixture, System.IDisposable
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "ScoreCalculationAlternativesFeature.feature"
+#line hidden
+
+ public static void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en"), "Score Calculation (alternative forms)", "In order to know my performance\r\nAs a player\r\nI want the system to calculate my t" +
+ "otal score", ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ public virtual void SetFixture(ScoreCalculationAlternativeFormsFeature.FixtureData fixtureData)
+ {
+ }
+
+ public static void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ this.ScenarioTearDown();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation (alternative forms)")]
+ [Xunit.TraitAttribute("Description", "One single spare")]
+ public virtual void OneSingleSpare()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("One single spare", ((string[])(null)));
+#line 7
+this.ScenarioSetup(scenarioInfo);
+#line 8
+ testRunner.Given("a new bowling game");
+#line 9
+ testRunner.When("I roll the following series:\t3,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1");
+#line 10
+ testRunner.Then("my total score should be 29");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation (alternative forms)")]
+ [Xunit.TraitAttribute("Description", "All spares")]
+ public virtual void AllSpares()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All spares", ((string[])(null)));
+#line 12
+this.ScenarioSetup(scenarioInfo);
+#line 13
+ testRunner.Given("a new bowling game");
+#line 14
+ testRunner.When("I roll 10 times 1 and 9");
+#line 15
+ testRunner.And("I roll 1");
+#line 16
+ testRunner.Then("my total score should be 110");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation (alternative forms)")]
+ [Xunit.TraitAttribute("Description", "Yet another beginners game")]
+ public virtual void YetAnotherBeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Yet another beginners game", ((string[])(null)));
+#line 18
+this.ScenarioSetup(scenarioInfo);
+#line 19
+ testRunner.Given("a new bowling game");
+#line hidden
+ TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
+ "Pins"});
+ table1.AddRow(new string[] {
+ "2"});
+ table1.AddRow(new string[] {
+ "7"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "5"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "3"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "4"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "8"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+ table1.AddRow(new string[] {
+ "1"});
+#line 20
+ testRunner.When("I roll", ((string)(null)), table1);
+#line 42
+ testRunner.Then("my total score should be 43");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ public class FixtureData : System.IDisposable
+ {
+
+ public FixtureData()
+ {
+ ScoreCalculationAlternativeFormsFeature.FeatureSetup();
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ ScoreCalculationAlternativeFormsFeature.FeatureTearDown();
+ }
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationFeature.feature b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationFeature.feature
new file mode 100644
index 00000000..ec795307
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationFeature.feature
@@ -0,0 +1,37 @@
+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
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationFeature.feature.cs b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationFeature.feature.cs
new file mode 100644
index 00000000..a85aba1e
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.Specflow/ScoreCalculationFeature.feature.cs
@@ -0,0 +1,185 @@
+// ------------------------------------------------------------------------------
+//
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.2.0.0
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+// ------------------------------------------------------------------------------
+namespace Bowling.Specflow
+{
+ using TechTalk.SpecFlow;
+
+
+ public partial class ScoreCalculationFeature : Xunit.IUseFixture, System.IDisposable
+ {
+
+ private static TechTalk.SpecFlow.ITestRunner testRunner;
+
+#line 1 "ScoreCalculationFeature.feature"
+#line hidden
+
+ public static void FeatureSetup()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en"), "Score Calculation", "In order to know my performance\r\nAs a player\r\nI want the system to calculate my t" +
+ "otal score", ((string[])(null)));
+ testRunner.OnFeatureStart(featureInfo);
+ }
+
+ public virtual void SetFixture(ScoreCalculationFeature.FixtureData fixtureData)
+ {
+ }
+
+ public static void FeatureTearDown()
+ {
+ testRunner.OnFeatureEnd();
+ testRunner = null;
+ }
+
+ public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
+ {
+ testRunner.OnScenarioStart(scenarioInfo);
+ }
+
+ public virtual void ScenarioTearDown()
+ {
+ testRunner.OnScenarioEnd();
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ this.ScenarioTearDown();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation")]
+ [Xunit.TraitAttribute("Description", "Gutter game")]
+ public virtual void GutterGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Gutter game", ((string[])(null)));
+#line 6
+this.ScenarioSetup(scenarioInfo);
+#line 7
+ testRunner.Given("a new bowling game");
+#line 8
+ testRunner.When("all of my balls are landing in the gutter");
+#line 9
+ testRunner.Then("my total score should be 0");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation")]
+ [Xunit.TraitAttribute("Description", "Beginners game")]
+ public virtual void BeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Beginners game", ((string[])(null)));
+#line 11
+this.ScenarioSetup(scenarioInfo);
+#line 12
+ testRunner.Given("a new bowling game");
+#line 13
+ testRunner.When("I roll 2 and 7");
+#line 14
+ testRunner.And("I roll 3 and 4");
+#line 15
+ testRunner.And("I roll 8 times 1 and 1");
+#line 16
+ testRunner.Then("my total score should be 32");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation")]
+ [Xunit.TraitAttribute("Description", "Another beginners game")]
+ public virtual void AnotherBeginnersGame()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Another beginners game", ((string[])(null)));
+#line 18
+this.ScenarioSetup(scenarioInfo);
+#line 19
+ testRunner.Given("a new bowling game");
+#line 20
+ testRunner.When("I roll the following series:\t2,7,3,4,1,1,5,1,1,1,1,1,1,1,1,1,1,1,5,1");
+#line 21
+ testRunner.Then("my total score should be 40");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation")]
+ [Xunit.TraitAttribute("Description", "All Strikes")]
+ public virtual void AllStrikes()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All Strikes", ((string[])(null)));
+#line 23
+this.ScenarioSetup(scenarioInfo);
+#line 24
+ testRunner.Given("a new bowling game");
+#line 25
+ testRunner.When("all of my rolls are strikes");
+#line 26
+ testRunner.Then("my total score should be 300");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation")]
+ [Xunit.TraitAttribute("Description", "One single spare")]
+ public virtual void OneSingleSpare()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("One single spare", ((string[])(null)));
+#line 28
+this.ScenarioSetup(scenarioInfo);
+#line 29
+ testRunner.Given("a new bowling game");
+#line 30
+ testRunner.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");
+#line 31
+ testRunner.Then("my total score should be 29");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [Xunit.FactAttribute()]
+ [Xunit.TraitAttribute("FeatureTitle", "Score Calculation")]
+ [Xunit.TraitAttribute("Description", "All spares")]
+ public virtual void AllSpares()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("All spares", ((string[])(null)));
+#line 33
+this.ScenarioSetup(scenarioInfo);
+#line 34
+ testRunner.Given("a new bowling game");
+#line 35
+ testRunner.When("I roll 10 times 1 and 9");
+#line 36
+ testRunner.And("I roll 1");
+#line 37
+ testRunner.Then("my total score should be 110");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ public class FixtureData : System.IDisposable
+ {
+
+ public FixtureData()
+ {
+ ScoreCalculationFeature.FeatureSetup();
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ ScoreCalculationFeature.FeatureTearDown();
+ }
+ }
+ }
+}
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling.sln b/BowlingKata/BowlingKata-XUnit/Bowling.sln
new file mode 100644
index 00000000..2bd90eb9
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling", "Bowling\Bowling.csproj", "{B065A18E-57BD-4399-AAF7-BD2FA0147FCB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling.Specflow", "Bowling.Specflow\Bowling.Specflow.csproj", "{D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D1FC8B4C-8553-4B50-BFC3-1BA12CDABBAC}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling/Bowling.csproj b/BowlingKata/BowlingKata-XUnit/Bowling/Bowling.csproj
new file mode 100644
index 00000000..224516dd
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling/Bowling.csproj
@@ -0,0 +1,59 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {B065A18E-57BD-4399-AAF7-BD2FA0147FCB}
+ Library
+ Properties
+ Bowling
+ Bowling
+ v3.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling/Game.cs b/BowlingKata/BowlingKata-XUnit/Bowling/Game.cs
new file mode 100644
index 00000000..b3238058
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling/Game.cs
@@ -0,0 +1,67 @@
+namespace Bowling
+{
+ public class Game
+ {
+ private int[] rolls = new int[21];
+ private int currentRoll;
+
+ public void Roll(int pins)
+ {
+ rolls[currentRoll++] = pins;
+ }
+
+ public int Score
+ {
+ get
+ {
+ int score = 0;
+ int frameIndex = 0;
+ for (int frame = 0; frame < 10; frame++)
+ {
+ if (isStrike(frameIndex))
+ {
+ score += 10 + strikeBonus(frameIndex);
+ frameIndex++;
+ }
+ else if (isSpare(frameIndex))
+ {
+ score += 10 + spareBonus(frameIndex);
+ frameIndex += 2;
+ }
+ else
+ {
+ score += sumOfBallsInFrame(frameIndex);
+ frameIndex += 2;
+ }
+ }
+ return score;
+ }
+ }
+
+ private bool isStrike(int frameIndex)
+ {
+ return rolls[frameIndex] == 10;
+ }
+
+ private int sumOfBallsInFrame(int frameIndex)
+ {
+ return rolls[frameIndex] + rolls[frameIndex + 1];
+ }
+
+ private int spareBonus(int frameIndex)
+ {
+ return rolls[frameIndex + 2];
+ }
+
+ private int strikeBonus(int frameIndex)
+ {
+ return rolls[frameIndex + 1] + rolls[frameIndex + 2];
+ }
+
+ private bool isSpare(int frameIndex)
+ {
+ return rolls[frameIndex] + rolls[frameIndex + 1] == 10;
+ }
+
+ }
+}
diff --git a/BowlingKata/BowlingKata-XUnit/Bowling/Properties/AssemblyInfo.cs b/BowlingKata/BowlingKata-XUnit/Bowling/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..638bab22
--- /dev/null
+++ b/BowlingKata/BowlingKata-XUnit/Bowling/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+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")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Bowling")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. 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("7e637ff2-1f70-4d59-bedf-78202aeae595")]
+
+// 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 Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]