add first C# unit test

This commit is contained in:
Vinzenz Schroeter 2024-10-20 12:29:45 +02:00
parent 474848e2ea
commit bcd65fb4f0
4 changed files with 53 additions and 2 deletions

View file

@ -0,0 +1,14 @@
namespace ServicePoint.Tests;
public class CommandTests
{
private Connection _fakeConnection = Connection.Fake();
[Fact]
public void Test1()
{
var command = Command.Clear();
_fakeConnection.Send(command);
Assert.Throws<NullReferenceException>(() => _fakeConnection.Send(command));
}
}

View file

@ -0,0 +1,3 @@
global using System;
global using Xunit;
global using ServicePoint;

View file

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ServicePoint\ServicePoint.csproj" />
</ItemGroup>
</Project>

View file

@ -1,8 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint", "ServicePoint/ServicePoint.csproj", "{70EFFA3F-012A-4518-9627-466BEAE4252E}"
#
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint", "ServicePoint\ServicePoint.csproj", "{70EFFA3F-012A-4518-9627-466BEAE4252E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lang-cs", "examples/lang_cs/lang_cs.csproj", "{DA3B8B6E-993A-47DA-844B-F92AF520FF59}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lang-cs", "examples\lang_cs\lang_cs.csproj", "{DA3B8B6E-993A-47DA-844B-F92AF520FF59}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{C2F8EC4A-2426-4DC3-990F-C43810B183F5}"
ProjectSection(SolutionItems) = preProject
@ -10,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{C2F8EC
..\..\.envrc = ..\..\.envrc
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint.Tests", "ServicePoint.Tests\ServicePoint.Tests.csproj", "{CDA70D8F-E0EC-46E3-AF96-511267DF0BA0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -24,5 +27,9 @@ Global
{DA3B8B6E-993A-47DA-844B-F92AF520FF59}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA3B8B6E-993A-47DA-844B-F92AF520FF59}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA3B8B6E-993A-47DA-844B-F92AF520FF59}.Release|Any CPU.Build.0 = Release|Any CPU
{CDA70D8F-E0EC-46E3-AF96-511267DF0BA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CDA70D8F-E0EC-46E3-AF96-511267DF0BA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDA70D8F-E0EC-46E3-AF96-511267DF0BA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CDA70D8F-E0EC-46E3-AF96-511267DF0BA0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal