-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ca5a83
commit 7ac7827
Showing
9 changed files
with
117 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,16 @@ | ||
namespace ReqnrollQuickstart.App; | ||
|
||
// to be used later | ||
public record Currency(string Symbol, decimal Value) | ||
{ | ||
public static Currency operator+(Currency a, Currency b) | ||
{ | ||
if (a.Symbol != b.Symbol) | ||
throw new InvalidOperationException("Cannot add different currencies!"); | ||
return new Currency(a.Symbol, a.Value + b.Value); | ||
} | ||
public static Currency operator *(Currency a, int b) | ||
{ | ||
return new Currency(a.Symbol, a.Value * b); | ||
} | ||
} |
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,16 @@ | ||
namespace ReqnrollQuickstart.App; | ||
|
||
public class PriceCalculator | ||
{ | ||
// the item prices are hard coded for now | ||
private readonly Dictionary<string, decimal> _priceTable = new() | ||
{ | ||
{ "Electric guitar", 180.0m }, | ||
{ "Guitar pick", 1.5m } | ||
}; | ||
|
||
public decimal CalculatePrice(Dictionary<string, int> basket) | ||
{ | ||
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
15 changes: 15 additions & 0 deletions
15
ReqnrollQuickstart.Specs/Features/PriceCalculation.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Feature: Price calculation | ||
|
||
This feature is about calculating the basket price | ||
|
||
We work with fixed item prices for now: | ||
* Electric guitar: $180 | ||
* Guitar pick: $1.5 | ||
|
||
Rule: The price for a basket with items can be calculated based on the item prices | ||
|
||
Scenario: Client has a simple basket | ||
Given the client started shopping | ||
And the client added 1 pcs of "Electric guitar" to the basket | ||
When the basket is prepared | ||
Then the basket price should be $180.0 |
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,4 @@ | ||
global using FluentAssertions; | ||
global using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
global using Reqnroll; | ||
global using ReqnrollQuickstart.App; |
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageReference Include="Reqnroll.MsTest" Version="1.0.0-pre20240125-60" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" /> | ||
<PackageReference Include="FluentAssertions" Version="6.12.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ReqnrollQuickstart.App\ReqnrollQuickstart.App.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<!-- hiding .gitkeep files in Visual Studio; they are only needed to ensure the existence of the empty folders in git --> | ||
<None Update="**/.gitkeep" Visible="false" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Empty file.
Empty file.
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 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.8.34316.72 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReqnrollQuickstart.Specs", "ReqnrollQuickstart.Specs\ReqnrollQuickstart.Specs.csproj", "{4408B957-D6D8-4334-8E40-A225DB7D5209}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReqnrollQuickstart.App", "ReqnrollQuickstart.App\ReqnrollQuickstart.App.csproj", "{98891CEA-0EED-4BDE-A884-C64A9CA388D5}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{4408B957-D6D8-4334-8E40-A225DB7D5209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4408B957-D6D8-4334-8E40-A225DB7D5209}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4408B957-D6D8-4334-8E40-A225DB7D5209}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4408B957-D6D8-4334-8E40-A225DB7D5209}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{98891CEA-0EED-4BDE-A884-C64A9CA388D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{98891CEA-0EED-4BDE-A884-C64A9CA388D5}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{98891CEA-0EED-4BDE-A884-C64A9CA388D5}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{98891CEA-0EED-4BDE-A884-C64A9CA388D5}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {3A4151D1-FE77-4163-8587-0D803F3CA2F0} | ||
EndGlobalSection | ||
EndGlobal |