Skip to content
Browse files

added WP7 version of BowlingKata

  • Loading branch information...
1 parent f12b1cb commit 493029a945d1d4a6993816551b84317044687787 @aximus committed Apr 2, 2011
Showing with 1,128 additions and 0 deletions.
  1. +19 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/App.xaml
  2. +129 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/App.xaml.cs
  3. BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/ApplicationIcon.png
  4. BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Background.png
  5. +136 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Bowling.Specflow.csproj
  6. +92 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/BowlingSteps.cs
  7. +37 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Features/ScoreCalculation.feature
  8. +170 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Features/ScoreCalculation.feature.cs
  9. +42 −0 ...a/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Features/ScoreCalculationAlternatives.feature
  10. +155 −0 ...owlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Features/ScoreCalculationAlternatives.feature.cs
  11. +45 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/MainPage.xaml
  12. +21 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/MainPage.xaml.cs
  13. +6 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Properties/AppManifest.xml
  14. +35 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Properties/AssemblyInfo.cs
  15. +32 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Properties/WMAppManifest.xml
  16. BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/SplashScreenImage.jpg
  17. +10 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/app.config
  18. +31 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.sln
  19. +66 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling/Bowling.csproj
  20. +67 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling/Game.cs
  21. +35 −0 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling/Properties/AssemblyInfo.cs
  22. BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/lib/Microsoft.Silverlight.Testing.dll
  23. BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/lib/Microsoft.Silverlight.Testing.pdb
  24. BIN ...lingKata-WindowsPhone7-MsTest/lib/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll
  25. BIN ...lingKata-WindowsPhone7-MsTest/lib/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb
View
19 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/App.xaml
@@ -0,0 +1,19 @@
+<Application
+ x:Class="Bowling.Specflow.WindowsPhone7.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
+ xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
+
+ <!--Application Resources-->
+ <Application.Resources>
+ </Application.Resources>
+
+ <Application.ApplicationLifetimeObjects>
+ <!--Required object that handles lifetime events for the application-->
+ <shell:PhoneApplicationService
+ Launching="Application_Launching" Closing="Application_Closing"
+ Activated="Application_Activated" Deactivated="Application_Deactivated"/>
+ </Application.ApplicationLifetimeObjects>
+
+</Application>
View
129 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/App.xaml.cs
@@ -0,0 +1,129 @@
+using System.Windows;
+using System.Windows.Navigation;
+using Microsoft.Phone.Controls;
+using Microsoft.Phone.Shell;
+
+namespace Bowling.Specflow.WindowsPhone7
+{
+ public partial class App : Application
+ {
+ /// <summary>
+ /// Provides easy access to the root frame of the Phone Application.
+ /// </summary>
+ /// <returns>The root frame of the Phone Application.</returns>
+ public PhoneApplicationFrame RootFrame
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Constructor for the Application object.
+ /// </summary>
+ public App()
+ {
+ // Global handler for uncaught exceptions.
+ UnhandledException += Application_UnhandledException;
+
+ // Show graphics profiling information while debugging.
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // Display the current frame rate counters.
+ Application.Current.Host.Settings.EnableFrameRateCounter = true;
+
+ // Show the areas of the app that are being redrawn in each frame.
+ //Application.Current.Host.Settings.EnableRedrawRegions = true;
+
+ // Enable non-production analysis visualization mode,
+ // which shows areas of a page that are being GPU accelerated with a colored overlay.
+ //Application.Current.Host.Settings.EnableCacheVisualization = true;
+ }
+
+ // Standard Silverlight initialization
+ InitializeComponent();
+
+ // Phone-specific initialization
+ InitializePhoneApplication();
+ }
+
+ // Code to execute when the application is launching (eg, from Start)
+ // This code will not execute when the application is reactivated
+ private void Application_Launching(object sender, LaunchingEventArgs e)
+ {
+ }
+
+ // Code to execute when the application is activated (brought to foreground)
+ // This code will not execute when the application is first launched
+ private void Application_Activated(object sender, ActivatedEventArgs e)
+ {
+ }
+
+ // Code to execute when the application is deactivated (sent to background)
+ // This code will not execute when the application is closing
+ private void Application_Deactivated(object sender, DeactivatedEventArgs e)
+ {
+ }
+
+ // Code to execute when the application is closing (eg, user hit Back)
+ // This code will not execute when the application is deactivated
+ private void Application_Closing(object sender, ClosingEventArgs e)
+ {
+ }
+
+ // Code to execute if a navigation fails
+ private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
+ {
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // A navigation has failed; break into the debugger
+ System.Diagnostics.Debugger.Break();
+ }
+ }
+
+ // Code to execute on Unhandled Exceptions
+ private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+ {
+ if (System.Diagnostics.Debugger.IsAttached)
+ {
+ // An unhandled exception has occurred; break into the debugger
+ System.Diagnostics.Debugger.Break();
+ }
+ }
+
+ #region Phone application initialization
+
+ // Avoid double-initialization
+ private bool phoneApplicationInitialized = false;
+
+ // Do not add any additional code to this method
+ private void InitializePhoneApplication()
+ {
+ if (phoneApplicationInitialized)
+ return;
+
+ // Create the frame but don't set it as RootVisual yet; this allows the splash
+ // screen to remain active until the application is ready to render.
+ RootFrame = new PhoneApplicationFrame();
+ RootFrame.Navigated += CompleteInitializePhoneApplication;
+
+ // Handle navigation failures
+ RootFrame.NavigationFailed += RootFrame_NavigationFailed;
+
+ // Ensure we don't initialize again
+ phoneApplicationInitialized = true;
+ }
+
+ // Do not add any additional code to this method
+ private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
+ {
+ // Set the root visual to allow the application to render
+ if (RootVisual != RootFrame)
+ RootVisual = RootFrame;
+
+ // Remove this handler since it is no longer needed
+ RootFrame.Navigated -= CompleteInitializePhoneApplication;
+ }
+
+ #endregion
+ }
+}
View
BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/ApplicationIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
136 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Bowling.Specflow.csproj
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.20506</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{B42C4E11-B768-44B9-BADF-EAF142CED85C}</ProjectGuid>
+ <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Bowling.Specflow</RootNamespace>
+ <AssemblyName>Bowling.Specflow</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
+ <TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile>
+ <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
+ <SilverlightApplication>true</SilverlightApplication>
+ <SupportedCultures>
+ </SupportedCultures>
+ <XapOutputs>true</XapOutputs>
+ <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
+ <XapFilename>Bowling.Specflow.WindowsPhone7.xap</XapFilename>
+ <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
+ <SilverlightAppEntry>Bowling.Specflow.WindowsPhone7.App</SilverlightAppEntry>
+ <ValidateXaml>true</ValidateXaml>
+ <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>Bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <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;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.Phone" />
+ <Reference Include="Microsoft.Phone.Interop" />
+ <Reference Include="Microsoft.Silverlight.Testing">
+ <HintPath>..\lib\Microsoft.Silverlight.Testing.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight">
+ <HintPath>..\lib\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Windows" />
+ <Reference Include="system" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Net" />
+ <Reference Include="System.Xml" />
+ <Reference Include="TechTalk.SpecFlow.WindowsPhone7">
+ <HintPath>$(ProgramFiles)\TechTalk\SpecFlow\TechTalk.SpecFlow.WindowsPhone7.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="App.xaml.cs">
+ <DependentUpon>App.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="BowlingSteps.cs" />
+ <Compile Include="Features\ScoreCalculation.feature.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>ScoreCalculation.feature</DependentUpon>
+ </Compile>
+ <Compile Include="Features\ScoreCalculationAlternatives.feature.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>ScoreCalculationAlternatives.feature</DependentUpon>
+ </Compile>
+ <Compile Include="MainPage.xaml.cs">
+ <DependentUpon>MainPage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ApplicationDefinition Include="App.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </ApplicationDefinition>
+ <Page Include="MainPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="Features\ScoreCalculation.feature">
+ <Generator>SpecFlowSingleFileGenerator</Generator>
+ <LastGenOutput>ScoreCalculation.feature.cs</LastGenOutput>
+ </None>
+ <None Include="Features\ScoreCalculationAlternatives.feature">
+ <Generator>SpecFlowSingleFileGenerator</Generator>
+ <LastGenOutput>ScoreCalculationAlternatives.feature.cs</LastGenOutput>
+ </None>
+ <None Include="Properties\AppManifest.xml" />
+ <None Include="Properties\WMAppManifest.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="ApplicationIcon.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Background.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="SplashScreenImage.jpg" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Bowling\Bowling.csproj">
+ <Project>{0BA96CED-139C-4B59-9061-373705EAE449}</Project>
+ <Name>Bowling</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.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>
+ -->
+ <ProjectExtensions />
+</Project>
View
92 BowlingKata/BowlingKata-WindowsPhone7-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"]));
+ }
+ }
+ }
+}
View
37 ...gKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Features/ScoreCalculation.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
View
170 ...ta/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Features/ScoreCalculation.feature.cs
@@ -0,0 +1,170 @@
+// ------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.5.0.0
+// Runtime Version:4.0.30319.225
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+// ------------------------------------------------------------------------------
+#region Designer generated code
+namespace Bowling.Specflow.Features
+{
+ using TechTalk.SpecFlow;
+
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.5.0.0")]
+ [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [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()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Score Calculation", "In order to know my performance\nAs a player\nI want the system to calculate my tot" +
+ "al score", GenerationTargetLanguage.CSharp, ((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();
+ }
+ }
+}
+#endregion
View
42 ...gKata-WindowsPhone7-MsTest/Bowling.Specflow/Features/ScoreCalculationAlternatives.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
View
155 ...ta-WindowsPhone7-MsTest/Bowling.Specflow/Features/ScoreCalculationAlternatives.feature.cs
@@ -0,0 +1,155 @@
+// ------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by SpecFlow (http://www.specflow.org/).
+// SpecFlow Version:1.5.0.0
+// Runtime Version:4.0.30319.225
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+// ------------------------------------------------------------------------------
+#region Designer generated code
+namespace Bowling.Specflow.Features
+{
+ using TechTalk.SpecFlow;
+
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.5.0.0")]
+ [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [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()
+ {
+ testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
+ TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Score Calculation (alternative forms)", "In order to know my performance\nAs a player\nI want the system to calculate my tot" +
+ "al score", GenerationTargetLanguage.CSharp, ((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();
+ }
+ }
+}
+#endregion
View
45 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/MainPage.xaml
@@ -0,0 +1,45 @@
+<phone:PhoneApplicationPage
+ x:Class="Bowling.Specflow.MainPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
+ xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
+ FontFamily="{StaticResource PhoneFontFamilyNormal}"
+ FontSize="{StaticResource PhoneFontSizeNormal}"
+ Foreground="{StaticResource PhoneForegroundBrush}"
+ SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
+ shell:SystemTray.IsVisible="False" Loaded="PhoneApplicationPage_Loaded">
+
+ <!--LayoutRoot is the root grid where all page content is placed-->
+ <Grid x:Name="LayoutRoot" Background="Transparent">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="*"/>
+ </Grid.RowDefinitions>
+
+ <!--TitlePanel contains the name of the application and page title-->
+ <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
+ <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
+ <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
+ </StackPanel>
+
+ <!--ContentPanel - place additional content here-->
+ <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"></Grid>
+ </Grid>
+
+ <!--Sample code showing usage of ApplicationBar-->
+ <!--<phone:PhoneApplicationPage.ApplicationBar>
+ <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
+ <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
+ <shell:ApplicationBar.MenuItems>
+ <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
+ <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
+ </shell:ApplicationBar.MenuItems>
+ </shell:ApplicationBar>
+ </phone:PhoneApplicationPage.ApplicationBar>-->
+
+</phone:PhoneApplicationPage>
View
21 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/MainPage.xaml.cs
@@ -0,0 +1,21 @@
+using System.Windows;
+using Microsoft.Phone.Controls;
+using Microsoft.Silverlight.Testing;
+
+namespace Bowling.Specflow
+{
+ public partial class MainPage : PhoneApplicationPage
+ {
+ public MainPage()
+ {
+ InitializeComponent();
+ }
+
+ private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
+ {
+ var testPage = UnitTestSystem.CreateTestPage() as IMobileTestPage;
+ BackKeyPress += (x, xe) => xe.Cancel = testPage.NavigateBack();
+ (Application.Current.RootVisual as PhoneApplicationFrame).Content = testPage;
+ }
+ }
+}
View
6 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Properties/AppManifest.xml
@@ -0,0 +1,6 @@
+<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Deployment.Parts>
+ </Deployment.Parts>
+</Deployment>
View
35 BowlingKata/BowlingKata-WindowsPhone7-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.WindowsPhon7")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Bowling.Specflow.WindowsPhon7")]
+[assembly: AssemblyCopyright("Copyright © 2011")]
+[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("7343d11f-5c26-40fb-9e78-ed97868771d7")]
+
+// 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")]
View
32 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/Properties/WMAppManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.0">
+ <App xmlns="" ProductID="{90bd5618-0731-432c-8e04-d576d4677e31}" Title="Bowling.Specflow" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="Bowling.Specflow author" Description="Sample description" Publisher="Bowling.Specflow">
+ <IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
+ <Capabilities>
+ <Capability Name="ID_CAP_GAMERSERVICES"/>
+ <Capability Name="ID_CAP_IDENTITY_DEVICE"/>
+ <Capability Name="ID_CAP_IDENTITY_USER"/>
+ <Capability Name="ID_CAP_LOCATION"/>
+ <Capability Name="ID_CAP_MEDIALIB"/>
+ <Capability Name="ID_CAP_MICROPHONE"/>
+ <Capability Name="ID_CAP_NETWORKING"/>
+ <Capability Name="ID_CAP_PHONEDIALER"/>
+ <Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
+ <Capability Name="ID_CAP_SENSORS"/>
+ <Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
+ </Capabilities>
+ <Tasks>
+ <DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
+ </Tasks>
+ <Tokens>
+ <PrimaryToken TokenID="Bowling.SpecflowToken" TaskName="_default">
+ <TemplateType5>
+ <BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
+ <Count>0</Count>
+ <Title>Bowling.Specflow</Title>
+ </TemplateType5>
+ </PrimaryToken>
+ </Tokens>
+ </App>
+</Deployment>
View
BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/SplashScreenImage.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
10 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.Specflow/app.config
@@ -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.WindowsPhone7" />
+ </specFlow>
+</configuration>
View
31 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling", "Bowling\Bowling.csproj", "{0BA96CED-139C-4B59-9061-373705EAE449}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bowling.Specflow", "Bowling.Specflow\Bowling.Specflow.csproj", "{B42C4E11-B768-44B9-BADF-EAF142CED85C}"
+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
+ {0BA96CED-139C-4B59-9061-373705EAE449}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0BA96CED-139C-4B59-9061-373705EAE449}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0BA96CED-139C-4B59-9061-373705EAE449}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0BA96CED-139C-4B59-9061-373705EAE449}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B42C4E11-B768-44B9-BADF-EAF142CED85C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B42C4E11-B768-44B9-BADF-EAF142CED85C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B42C4E11-B768-44B9-BADF-EAF142CED85C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {B42C4E11-B768-44B9-BADF-EAF142CED85C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B42C4E11-B768-44B9-BADF-EAF142CED85C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B42C4E11-B768-44B9-BADF-EAF142CED85C}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
66 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling/Bowling.csproj
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.20506</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0BA96CED-139C-4B59-9061-373705EAE449}</ProjectGuid>
+ <ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Bowling</RootNamespace>
+ <AssemblyName>Bowling</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
+ <TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile>
+ <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
+ <SilverlightApplication>false</SilverlightApplication>
+ <ValidateXaml>true</ValidateXaml>
+ <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>Bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>Bin\Release</OutputPath>
+ <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System.Windows" />
+ <Reference Include="system" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Net" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Game.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
+ <ProjectExtensions />
+ <!-- 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>
View
67 BowlingKata/BowlingKata-WindowsPhone7-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;
+ }
+
+ }
+}
View
35 BowlingKata/BowlingKata-WindowsPhone7-MsTest/Bowling/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.WindowsPhon7")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Bowling.WindowsPhon7")]
+[assembly: AssemblyCopyright("Copyright © 2011")]
+[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("745b1967-ef73-4192-96ad-012c00f26f16")]
+
+// 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")]
View
BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/lib/Microsoft.Silverlight.Testing.dll
Binary file not shown.
View
BIN BowlingKata/BowlingKata-WindowsPhone7-MsTest/lib/Microsoft.Silverlight.Testing.pdb
Binary file not shown.
View
BIN ...-WindowsPhone7-MsTest/lib/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll
Binary file not shown.
View
BIN ...-WindowsPhone7-MsTest/lib/Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.pdb
Binary file not shown.

1 comment on commit 493029a

@darrencauthon

I'd like to take a quick shot at this. Perhaps I'm being picky, but I think there are a few things in this example (the name of the steps file, and the regular expressions) that promote a few of the misconceptions on how Cucumber or SpecFlow can or should be used. I'd like examples to be as close to the correct usage as possible...

Please sign in to comment.
Something went wrong with that request. Please try again.