forked from S-DRE/Bank-Kata_C-Sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RED: First test (acceptance) created
- Loading branch information
Showing
11 changed files
with
639 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,8 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bank", "Bank\Bank.csproj", "{0F68A395-EFF9-4FF4-80AA-091FFBD94C10}" | ||
ProjectSection(ProjectDependencies) = postProject | ||
{1C9DCC2D-22A7-40BB-8325-37260870309A} = {1C9DCC2D-22A7-40BB-8325-37260870309A} | ||
EndProjectSection | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BankShould", "BankShould\BankShould.csproj", "{1C9DCC2D-22A7-40BB-8325-37260870309A}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0F68A395-EFF9-4FF4-80AA-091FFBD94C10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0F68A395-EFF9-4FF4-80AA-091FFBD94C10}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0F68A395-EFF9-4FF4-80AA-091FFBD94C10}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0F68A395-EFF9-4FF4-80AA-091FFBD94C10}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{1C9DCC2D-22A7-40BB-8325-37260870309A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1C9DCC2D-22A7-40BB-8325-37260870309A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1C9DCC2D-22A7-40BB-8325-37260870309A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1C9DCC2D-22A7-40BB-8325-37260870309A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
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 @@ | ||
namespace Bank; | ||
|
||
public class Account | ||
{ | ||
public ProConsole ProConsole { get; } | ||
|
||
public Account(ProConsole proConsole) | ||
{ | ||
ProConsole = proConsole; | ||
} | ||
|
||
public void Deposit(int amount, Date date) | ||
{ | ||
|
||
} | ||
|
||
public void Withdraw(int amount, Date date) | ||
{ | ||
|
||
} | ||
|
||
public void PrintStatement() | ||
{ | ||
|
||
} | ||
} |
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 @@ | ||
namespace Bank; | ||
|
||
public class Bank | ||
{ | ||
|
||
} |
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</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,9 @@ | ||
namespace Bank; | ||
|
||
public class Date | ||
{ | ||
public Date(string s) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
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,9 @@ | ||
namespace Bank; | ||
|
||
public class ProConsole | ||
{ | ||
public void printLine(string lineToPrint) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
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,40 @@ | ||
using Bank; | ||
using Moq; | ||
|
||
namespace BankShould; | ||
|
||
public class BankShould | ||
{ | ||
[Fact] | ||
public void PerformPrintAListOfPreviousDepositsAndWithdrawals() | ||
{ | ||
/* | ||
* Date || Amount || Balance | ||
14/01/2012 || -500 || 2500 | ||
13/01/2012 || 2000 || 3000 | ||
10/01/2012 || 1000 || 1000 | ||
*/ | ||
|
||
var consoleMock = new Mock<ProConsole>(); | ||
ProConsole proConsoleMock = consoleMock.Object; | ||
|
||
// given | ||
var account = new Account(proConsoleMock); | ||
|
||
// when | ||
account.Deposit(1000, new Date("10/01/2012")); | ||
account.Deposit(2000, new Date("13/01/2012")); | ||
account.Withdraw(500, new Date("14/01/2012")); | ||
account.PrintStatement(); | ||
|
||
// then | ||
|
||
// It could also check a bunch of lines if the console has a method for stack of transactions | ||
consoleMock.Verify(console => console.printLine("Date || Amount || Balance")); | ||
consoleMock.Verify(console => console.printLine("14/01/2012 || -500 || 2500")); | ||
consoleMock.Verify(console => console.printLine("13/01/2012 || 2000 || 3000")); | ||
consoleMock.Verify(console => console.printLine("10/01/2012 || 1000 || 1000")); | ||
|
||
} | ||
} | ||
|
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,31 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
|
||
<RootNamespace>BankTest</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> | ||
<PackageReference Include="Moq" Version="4.18.4" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Bank\Bank.csproj" /> | ||
</ItemGroup> | ||
|
||
</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 @@ | ||
global using Xunit; |
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,11 @@ | ||
# Bank-Kata_C-Sharp | ||
Pair programming session of the Bank Kata in C# | ||
|
||
Using: | ||
* [xUnit](https://xunit.net/) as the testing framework | ||
* [Moq4](https://github.com/moq/moq4) as the mocking one. | ||
|
||
|
||
### Bank Kata link: | ||
https://www.codurance.com/katalyst/bank | ||
|