make csharpcore work. I add a missing NuGet, use only one test framework, downgrade to NET6 LTS and var some variables.

This commit is contained in:
Stéphane Bagnier 2023-10-27 10:40:48 +02:00
parent de1e9ed991
commit ffdfe37fcd
5 changed files with 17 additions and 17 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -8,13 +8,12 @@ using NUnit.Framework;
namespace GildedRoseTests;
[UseReporter(typeof(DiffReporter))]
[TestFixture]
public class ApprovalTest
{
[Test]
public void ThirtyDays()
{
StringBuilder fakeOutput = new StringBuilder();
var fakeOutput = new StringBuilder();
Console.SetOut(new StringWriter(fakeOutput));
Console.SetIn(new StringReader($"a{Environment.NewLine}"));

View File

@ -1,17 +1,17 @@
using Xunit;
using System.Collections.Generic;
using System.Collections.Generic;
using GildedRoseKata;
using NUnit.Framework;
namespace GildedRoseTests;
public class GildedRoseTest
{
[Fact]
[Test]
public void Foo()
{
IList<Item> items = new List<Item> { new Item { Name = "foo", SellIn = 0, Quality = 0 } };
GildedRose app = new GildedRose(items);
var items = new List<Item> { new Item { Name = "foo", SellIn = 0, Quality = 0 } };
var app = new GildedRose(items);
app.UpdateQuality();
Assert.Equal("fixme", items[0].Name);
Assert.AreEqual("fixme", items[0].Name);
}
}

View File

@ -2,17 +2,18 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<StartupObject>GildedRoseTests.TextTestFixture</StartupObject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ApprovalTests" Version="5.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="ApprovalTests" Version="5.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="coverlet.collector" Version="3.1.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
<ItemGroup>

View File

@ -10,7 +10,7 @@ public static class TextTestFixture
{
Console.WriteLine("OMGHAI!");
IList<Item> items = new List<Item>{
var items = new List<Item>{
new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20},
new Item {Name = "Aged Brie", SellIn = 2, Quality = 0},
new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7},