Merge pull request #6 from raget/upgrade-to-net6

upgrade to net6, update dependencies, conventions
This commit is contained in:
Radim Göth
2022-03-30 13:57:40 +02:00
committed by GitHub
4 changed files with 23 additions and 21 deletions

View File

@@ -11,18 +11,18 @@ namespace TheatricalPlayersRefactoringKata.Tests
{ {
[Test] [Test]
[UseReporter(typeof(DiffReporter))] [UseReporter(typeof(DiffReporter))]
public void test_statement_plain_text_example() public void Test_statement_plain_text_example()
{ {
var plays = new Dictionary<string, Play>(); var plays = new Dictionary<string, Play>();
plays.Add("hamlet", new Play("Hamlet", "tragedy")); plays.Add("hamlet", new Play("Hamlet", "tragedy"));
plays.Add("as-like", new Play("As You Like It", "comedy")); plays.Add("as-like", new Play("As You Like It", "comedy"));
plays.Add("othello", new Play("Othello", "tragedy")); plays.Add("othello", new Play("Othello", "tragedy"));
Invoice invoice = new Invoice("BigCo", new List<Performance>{new Performance("hamlet", 55), var invoice = new Invoice("BigCo", new List<Performance>{new Performance("hamlet", 55),
new Performance("as-like", 35), new Performance("as-like", 35),
new Performance("othello", 40)}); new Performance("othello", 40)});
StatementPrinter statementPrinter = new StatementPrinter(); var statementPrinter = new StatementPrinter();
var result = statementPrinter.Print(invoice, plays); var result = statementPrinter.Print(invoice, plays);
Approvals.Verify(result); Approvals.Verify(result);
@@ -30,18 +30,18 @@ namespace TheatricalPlayersRefactoringKata.Tests
[Test] [Test]
[UseReporter(typeof(DiffReporter))] [UseReporter(typeof(DiffReporter))]
public void test_statement_html_example() public void Test_statement_html_example()
{ {
var plays = new Dictionary<string, Play>(); var plays = new Dictionary<string, Play>();
plays.Add("hamlet", new Play("Hamlet", "tragedy")); plays.Add("hamlet", new Play("Hamlet", "tragedy"));
plays.Add("as-like", new Play("As You Like It", "comedy")); plays.Add("as-like", new Play("As You Like It", "comedy"));
plays.Add("othello", new Play("Othello", "tragedy")); plays.Add("othello", new Play("Othello", "tragedy"));
Invoice invoice = new Invoice("BigCo", new List<Performance>{new Performance("hamlet", 55), var invoice = new Invoice("BigCo", new List<Performance>{new Performance("hamlet", 55),
new Performance("as-like", 35), new Performance("as-like", 35),
new Performance("othello", 40)}); new Performance("othello", 40)});
StatementPrinter statementPrinter = new StatementPrinter(); var statementPrinter = new StatementPrinter();
// Not implemented yet // Not implemented yet
// var result = statementPrinter.PrintAsHtml(invoice, plays); // var result = statementPrinter.PrintAsHtml(invoice, plays);
@@ -50,16 +50,16 @@ namespace TheatricalPlayersRefactoringKata.Tests
[Test] [Test]
[UseReporter(typeof(DiffReporter))] [UseReporter(typeof(DiffReporter))]
public void test_statement_with_new_play_types() public void Test_statement_with_new_play_types()
{ {
var plays = new Dictionary<string, Play>(); var plays = new Dictionary<string, Play>();
plays.Add("henry-v", new Play("Henry V", "history")); plays.Add("henry-v", new Play("Henry V", "history"));
plays.Add("as-like", new Play("As You Like It", "pastoral")); plays.Add("as-like", new Play("As You Like It", "pastoral"));
Invoice invoice = new Invoice("BigCoII", new List<Performance>{new Performance("henry-v", 53), var invoice = new Invoice("BigCoII", new List<Performance>{new Performance("henry-v", 53),
new Performance("as-like", 55)}); new Performance("as-like", 55)});
StatementPrinter statementPrinter = new StatementPrinter(); var statementPrinter = new StatementPrinter();
Assert.Throws<Exception>(() => statementPrinter.Print(invoice, plays)); Assert.Throws<Exception>(() => statementPrinter.Print(invoice, plays));
} }

View File

@@ -1,19 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<LangVersion>10</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ApprovalTests" Version="4.0.0" /> <PackageReference Include="ApprovalTests" Version="5.7.2" />
<PackageReference Include="FakeItEasy" Version="6.2.1" /> <PackageReference Include="FakeItEasy" Version="7.3.1" />
<PackageReference Include="FluentAssertions" Version="5.10.3" /> <PackageReference Include="FluentAssertions" Version="6.5.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="NBuilder" Version="6.1.0" /> <PackageReference Include="NBuilder" Version="6.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NUnit" Version="3.13.1" /> <PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" /> <PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -41,11 +41,11 @@ namespace TheatricalPlayersRefactoringKata
if ("comedy" == play.Type) volumeCredits += (int)Math.Floor((decimal)perf.Audience / 5); if ("comedy" == play.Type) volumeCredits += (int)Math.Floor((decimal)perf.Audience / 5);
// print line for this order // print line for this order
result += String.Format(cultureInfo, " {0}: {1:C} ({2} seats)\n", play.Name, Convert.ToDecimal(thisAmount / 100), perf.Audience); result += string.Format(cultureInfo, " {0}: {1:C} ({2} seats)\n", play.Name, Convert.ToDecimal(thisAmount / 100), perf.Audience);
totalAmount += thisAmount; totalAmount += thisAmount;
} }
result += String.Format(cultureInfo, "Amount owed is {0:C}\n", Convert.ToDecimal(totalAmount / 100)); result += string.Format(cultureInfo, "Amount owed is {0:C}\n", Convert.ToDecimal(totalAmount / 100));
result += String.Format("You earned {0} credits\n", volumeCredits); result += string.Format("You earned {0} credits\n", volumeCredits);
return result; return result;
} }
} }

View File

@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<LangVersion>10</LangVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>