Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BowlingKata example for VB using MsTest
- Loading branch information
jbandi
committed
Jul 1, 2010
1 parent
fba502a
commit 1155a38
Showing
18 changed files
with
896 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 10.00 | ||
# Visual Studio 2008 | ||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Bowling", "Bowling\Bowling.vbproj", "{2D20C525-197E-43CA-9301-D2DA66DC9442}" | ||
EndProject | ||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Specs", "Specs\Specs.vbproj", "{EE1AF00F-FEFF-4F71-B432-B1CBE0F99E24}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2D20C525-197E-43CA-9301-D2DA66DC9442}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2D20C525-197E-43CA-9301-D2DA66DC9442}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2D20C525-197E-43CA-9301-D2DA66DC9442}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{2D20C525-197E-43CA-9301-D2DA66DC9442}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{EE1AF00F-FEFF-4F71-B432-B1CBE0F99E24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{EE1AF00F-FEFF-4F71-B432-B1CBE0F99E24}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{EE1AF00F-FEFF-4F71-B432-B1CBE0F99E24}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{EE1AF00F-FEFF-4F71-B432-B1CBE0F99E24}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
107 changes: 107 additions & 0 deletions
107
BowlingKata/BowlingKata-VB-MsTest/Bowling/Bowling.vbproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>9.0.30729</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{2D20C525-197E-43CA-9301-D2DA66DC9442}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>Bowling</RootNamespace> | ||
<AssemblyName>Bowling</AssemblyName> | ||
<FileAlignment>512</FileAlignment> | ||
<MyType>Windows</MyType> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<OptionExplicit>On</OptionExplicit> | ||
<OptionCompare>Binary</OptionCompare> | ||
<OptionStrict>Off</OptionStrict> | ||
<OptionInfer>On</OptionInfer> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<DefineDebug>true</DefineDebug> | ||
<DefineTrace>true</DefineTrace> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DocumentationFile>Bowling.xml</DocumentationFile> | ||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<DefineDebug>false</DefineDebug> | ||
<DefineTrace>true</DefineTrace> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DocumentationFile>Bowling.xml</DocumentationFile> | ||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Core"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Xml.Linq"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="System.Data.DataSetExtensions"> | ||
<RequiredTargetFramework>3.5</RequiredTargetFramework> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Import Include="Microsoft.VisualBasic" /> | ||
<Import Include="System" /> | ||
<Import Include="System.Collections" /> | ||
<Import Include="System.Collections.Generic" /> | ||
<Import Include="System.Data" /> | ||
<Import Include="System.Diagnostics" /> | ||
<Import Include="System.Linq" /> | ||
<Import Include="System.Xml.Linq" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Game.vb" /> | ||
<Compile Include="My Project\AssemblyInfo.vb" /> | ||
<Compile Include="My Project\Application.Designer.vb"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Application.myapp</DependentUpon> | ||
</Compile> | ||
<Compile Include="My Project\Resources.Designer.vb"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<Compile Include="My Project\Settings.Designer.vb"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="My Project\Resources.resx"> | ||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.vb</LastGenOutput> | ||
<CustomToolNamespace>My.Resources</CustomToolNamespace> | ||
<SubType>Designer</SubType> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="My Project\Application.myapp"> | ||
<Generator>MyApplicationCodeGenerator</Generator> | ||
<LastGenOutput>Application.Designer.vb</LastGenOutput> | ||
</None> | ||
<None Include="My Project\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<CustomToolNamespace>My</CustomToolNamespace> | ||
<LastGenOutput>Settings.Designer.vb</LastGenOutput> | ||
</None> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006"> | ||
<TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> | ||
<RunConfiguration id="d0c48504-5ab5-4539-9b41-135635936441" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" /> | ||
</TestList> | ||
</TestLists> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Namespace Bowling | ||
Public Class Game | ||
Private rolls As Integer() = New Integer(21) {} | ||
Private currentRoll As Integer | ||
|
||
Public Sub Roll(ByVal pins As Integer) | ||
currentRoll = currentRoll + 1 | ||
rolls(currentRoll) = pins | ||
End Sub | ||
|
||
Public ReadOnly Property Score() As Integer | ||
Get | ||
Dim theScore As Integer = 0 | ||
Dim frameIndex As Integer = 1 | ||
For frame As Integer = 1 To 10 | ||
If isStrike(frameIndex) Then | ||
theScore += 10 + strikeBonus(frameIndex) | ||
frameIndex += 1 | ||
ElseIf isSpare(frameIndex) Then | ||
theScore += 10 + spareBonus(frameIndex) | ||
frameIndex += 2 | ||
Else | ||
theScore += sumOfBallsInFrame(frameIndex) | ||
frameIndex += 2 | ||
End If | ||
Next | ||
Return theScore | ||
End Get | ||
End Property | ||
|
||
Private Function isStrike(ByVal frameIndex As Integer) As Boolean | ||
Return rolls(frameIndex) = 10 | ||
End Function | ||
|
||
Private Function sumOfBallsInFrame(ByVal frameIndex As Integer) As Integer | ||
Return rolls(frameIndex) + rolls(frameIndex + 1) | ||
End Function | ||
|
||
Private Function spareBonus(ByVal frameIndex As Integer) As Integer | ||
Return rolls(frameIndex + 2) | ||
End Function | ||
|
||
Private Function strikeBonus(ByVal frameIndex As Integer) As Integer | ||
Return rolls(frameIndex + 1) + rolls(frameIndex + 2) | ||
End Function | ||
|
||
Private Function isSpare(ByVal frameIndex As Integer) As Boolean | ||
Return rolls(frameIndex) + rolls(frameIndex + 1) = 10 | ||
End Function | ||
|
||
End Class | ||
End Namespace | ||
|
5 changes: 5 additions & 0 deletions
5
BowlingKata/BowlingKata-VB-MsTest/Bowling/LocalTestRun.testrunconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<TestRunConfiguration name="Local Test Run" id="d0c48504-5ab5-4539-9b41-135635936441" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006"> | ||
<Description>This is a default test run configuration for a local test run.</Description> | ||
<TestTypeSpecific /> | ||
</TestRunConfiguration> |
13 changes: 13 additions & 0 deletions
13
BowlingKata/BowlingKata-VB-MsTest/Bowling/My Project/Application.Designer.vb
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
BowlingKata/BowlingKata-VB-MsTest/Bowling/My Project/Application.myapp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<MySubMain>false</MySubMain> | ||
<SingleInstance>false</SingleInstance> | ||
<ShutdownMode>0</ShutdownMode> | ||
<EnableVisualStyles>true</EnableVisualStyles> | ||
<AuthenticationMode>0</AuthenticationMode> | ||
<ApplicationType>1</ApplicationType> | ||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit> | ||
</MyApplicationData> |
35 changes: 35 additions & 0 deletions
35
BowlingKata/BowlingKata-VB-MsTest/Bowling/My Project/AssemblyInfo.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Imports System | ||
Imports System.Reflection | ||
Imports 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. | ||
|
||
' Review the values of the assembly attributes | ||
|
||
<Assembly: AssemblyTitle("Bowling")> | ||
<Assembly: AssemblyDescription("")> | ||
<Assembly: AssemblyCompany("Microsoft")> | ||
<Assembly: AssemblyProduct("Bowling")> | ||
<Assembly: AssemblyCopyright("Copyright © Microsoft 2010")> | ||
<Assembly: AssemblyTrademark("")> | ||
|
||
<Assembly: ComVisible(False)> | ||
|
||
'The following GUID is for the ID of the typelib if this project is exposed to COM | ||
<Assembly: Guid("d62885ff-7880-49c2-9fac-772c531447d6")> | ||
|
||
' 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")> |
62 changes: 62 additions & 0 deletions
62
BowlingKata/BowlingKata-VB-MsTest/Bowling/My Project/Resources.Designer.vb
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.