From bcd65fb4f0a23af19432cfd011d00b4909590866 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Sun, 20 Oct 2024 12:29:45 +0200 Subject: [PATCH] add first C# unit test --- .../ServicePoint.Tests/CommandTests.cs | 14 ++++++++++ .../ServicePoint.Tests/GlobalUsings.cs | 3 +++ .../ServicePoint.Tests.csproj | 27 +++++++++++++++++++ .../servicepoint_binding_cs/ServicePoint.sln | 11 ++++++-- 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 crates/servicepoint_binding_cs/ServicePoint.Tests/CommandTests.cs create mode 100644 crates/servicepoint_binding_cs/ServicePoint.Tests/GlobalUsings.cs create mode 100644 crates/servicepoint_binding_cs/ServicePoint.Tests/ServicePoint.Tests.csproj diff --git a/crates/servicepoint_binding_cs/ServicePoint.Tests/CommandTests.cs b/crates/servicepoint_binding_cs/ServicePoint.Tests/CommandTests.cs new file mode 100644 index 0000000..bea8149 --- /dev/null +++ b/crates/servicepoint_binding_cs/ServicePoint.Tests/CommandTests.cs @@ -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(() => _fakeConnection.Send(command)); + } +} diff --git a/crates/servicepoint_binding_cs/ServicePoint.Tests/GlobalUsings.cs b/crates/servicepoint_binding_cs/ServicePoint.Tests/GlobalUsings.cs new file mode 100644 index 0000000..04c1d62 --- /dev/null +++ b/crates/servicepoint_binding_cs/ServicePoint.Tests/GlobalUsings.cs @@ -0,0 +1,3 @@ +global using System; +global using Xunit; +global using ServicePoint; diff --git a/crates/servicepoint_binding_cs/ServicePoint.Tests/ServicePoint.Tests.csproj b/crates/servicepoint_binding_cs/ServicePoint.Tests/ServicePoint.Tests.csproj new file mode 100644 index 0000000..d07e3a4 --- /dev/null +++ b/crates/servicepoint_binding_cs/ServicePoint.Tests/ServicePoint.Tests.csproj @@ -0,0 +1,27 @@ + + + + net8.0 + disable + enable + + false + true + + + + + + + + + + + + + + + + + + diff --git a/crates/servicepoint_binding_cs/ServicePoint.sln b/crates/servicepoint_binding_cs/ServicePoint.sln index c4d9165..0368e00 100644 --- a/crates/servicepoint_binding_cs/ServicePoint.sln +++ b/crates/servicepoint_binding_cs/ServicePoint.sln @@ -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