mirror of
https://github.com/ysoftdevs/Theatrical-Players-Refactoring-Kata.git
synced 2026-01-11 22:30:27 +01:00
example tests updated
This commit is contained in:
@@ -2,15 +2,16 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using ApprovalTests;
|
||||
using ApprovalTests.Reporters;
|
||||
using Xunit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace TheatricalPlayersRefactoringKata.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class StatementPrinterTests
|
||||
{
|
||||
[Fact]
|
||||
[Test]
|
||||
[UseReporter(typeof(DiffReporter))]
|
||||
public void test_statement_example()
|
||||
public void test_statement_plain_text_example()
|
||||
{
|
||||
var plays = new Dictionary<string, Play>();
|
||||
plays.Add("hamlet", new Play("Hamlet", "tragedy"));
|
||||
@@ -23,10 +24,32 @@ namespace TheatricalPlayersRefactoringKata.Tests
|
||||
|
||||
StatementPrinter statementPrinter = new StatementPrinter();
|
||||
var result = statementPrinter.Print(invoice, plays);
|
||||
|
||||
|
||||
Approvals.Verify(result);
|
||||
}
|
||||
[Fact]
|
||||
|
||||
[Test]
|
||||
[UseReporter(typeof(DiffReporter))]
|
||||
public void test_statement_html_example()
|
||||
{
|
||||
var plays = new Dictionary<string, Play>();
|
||||
plays.Add("hamlet", new Play("Hamlet", "tragedy"));
|
||||
plays.Add("as-like", new Play("As You Like It", "comedy"));
|
||||
plays.Add("othello", new Play("Othello", "tragedy"));
|
||||
|
||||
Invoice invoice = new Invoice("BigCo", new List<Performance>{new Performance("hamlet", 55),
|
||||
new Performance("as-like", 35),
|
||||
new Performance("othello", 40)});
|
||||
|
||||
StatementPrinter statementPrinter = new StatementPrinter();
|
||||
|
||||
// Not implemented yet
|
||||
// var result = statementPrinter.PrintAsHtml(invoice, plays);
|
||||
// Approvals.Verify(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[UseReporter(typeof(DiffReporter))]
|
||||
public void test_statement_with_new_play_types()
|
||||
{
|
||||
var plays = new Dictionary<string, Play>();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<h1>Statement for BigCo</h1>
|
||||
<table>
|
||||
<tr><th>play</th><th>seats</th><th>cost</th></tr>
|
||||
<tr><td>Hamlet</td><td>55</td><td>$650.00</td></tr>
|
||||
<tr><td>As You Like It</td><td>35</td><td>$580.00</td></tr>
|
||||
<tr><td>Othello</td><td>40</td><td>$500.00</td></tr>
|
||||
</table>
|
||||
<p>Amount owed is <em>$1,730.00</em></p>
|
||||
<p>You earned <em>47</em> credits</p>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
Statement for BigCo
|
||||
Henry V: $100.00 (53 seats)
|
||||
As You Like It: $100.00 (55 seats)
|
||||
Amount owed is $200.00
|
||||
You earned 48 credits
|
||||
@@ -1,20 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ApprovalTests" Version="4.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="FakeItEasy" Version="6.2.1" />
|
||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||
<PackageReference Include="NBuilder" Version="6.1.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TheatricalPlayersRefactoringKata\TheatricalPlayersRefactoringKata.csproj" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TheatricalPlayersRefactoringKata\TheatricalPlayersRefactoringKata.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=95df3736_002D330d_002D4608_002D8d90_002D535fe8f6aaa2/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="StatementPrinterTests" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||
<TestAncestor>
|
||||
<TestId>NUnit3x::47FAD5CE-0FB3-4C9F-A430-68E58A1B094F::net5.0::TheatricalPlayersRefactoringKata.Tests.StatementPrinterTests</TestId>
|
||||
</TestAncestor>
|
||||
</SessionState></s:String></wpf:ResourceDictionary>
|
||||
@@ -1,7 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
5
csharp/global.json
Normal file
5
csharp/global.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "5.0.103"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user