Skip to content

Commit

Permalink
Update tests to NUnit v4 syntax (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalmers authored Mar 25, 2024
1 parent cffa09c commit 22e5bcd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/Try.Tests/SnippetsServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task TestGet()
{
var snippetService = new SnippetsService(snippetsOptions, new System.Net.Http.HttpClient(), new MockNavigationManager());
var codeFiles = await snippetService.GetSnippetContentAsync("2021020540572059");
Assert.IsNotNull(codeFiles);
Assert.That(codeFiles, Is.Not.Null);
}

[Test]
Expand All @@ -53,14 +53,14 @@ public async Task TestPut()
{
var snippetService = new SnippetsService(snippetsOptions, new System.Net.Http.HttpClient(), new MockNavigationManager());
var id = await snippetService.SaveSnippetAsync(codeFiles);
Assert.IsNotNull(id);
Assert.That(id, Is.Not.Null);
Console.WriteLine(id);
var savedCodeFiles = await snippetService.GetSnippetContentAsync(id);
List<CodeFile> savedCodeFilesList = new List<CodeFile>(savedCodeFiles);
for (int i = 0; i < codeFiles.Count; i++ )
{
Assert.AreEqual(codeFiles[i].Path, savedCodeFilesList[i].Path);
Assert.AreEqual(codeFiles[i].Content, savedCodeFilesList[i].Content);
Assert.That(codeFiles[i].Path, Is.EqualTo(savedCodeFilesList[i].Path));
Assert.That(codeFiles[i].Content, Is.EqualTo(savedCodeFilesList[i].Content));
}
}

Expand All @@ -72,10 +72,10 @@ public void TestEncodeDecode()
Console.WriteLine(encoded);
var decoded = DecodeSnippetId(encoded);
Console.WriteLine(decoded);
Assert.AreEqual(snippetId, decoded);
Assert.That(snippetId, Is.EqualTo(decoded));
var encoded2 = EncodeSnippetId(snippetId);
Console.WriteLine(encoded2);
Assert.AreNotEqual(encoded, encoded2);
Assert.That(encoded, Is.Not.EqualTo(encoded2));
}
}
}
9 changes: 4 additions & 5 deletions src/Try.Tests/Try.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 22e5bcd

Please sign in to comment.