From 0b56a3d63b0959581c53cd67ad0762dcf7c1e54e Mon Sep 17 00:00:00 2001 From: tznind Date: Sun, 16 Mar 2025 20:13:35 +0000 Subject: [PATCH] Remove dependency on fluent assertions and fix folder paths --- Terminal.sln | 8 +------- .../ClassDiagram1.cd | 0 .../FakeInput.cs | 0 .../FakeNetInput.cs | 0 .../FakeOutput.cs | 0 .../FakeWindowsInput.cs | 0 .../GuiTestContext.cs | 8 ++++++-- .../TerminalGuiFluentTesting.csproj | 4 ---- .../With.cs | 0 .../FluentTests/BasicFluentAssertionTests.cs | 14 +++++--------- Tests/IntegrationTests/IntegrationTests.csproj | 1 + Tests/UnitTests/UnitTests.csproj | 1 - 12 files changed, 13 insertions(+), 23 deletions(-) rename {TerminalGuiFluentAssertions => TerminalGuiFluentTesting}/ClassDiagram1.cd (100%) rename {TerminalGuiFluentAssertions => TerminalGuiFluentTesting}/FakeInput.cs (100%) rename {TerminalGuiFluentAssertions => TerminalGuiFluentTesting}/FakeNetInput.cs (100%) rename {TerminalGuiFluentAssertions => TerminalGuiFluentTesting}/FakeOutput.cs (100%) rename {TerminalGuiFluentAssertions => TerminalGuiFluentTesting}/FakeWindowsInput.cs (100%) rename {TerminalGuiFluentAssertions => TerminalGuiFluentTesting}/GuiTestContext.cs (99%) rename {TerminalGuiFluentAssertions => TerminalGuiFluentTesting}/TerminalGuiFluentTesting.csproj (79%) rename {TerminalGuiFluentAssertions => TerminalGuiFluentTesting}/With.cs (100%) rename Tests/{UnitTests => IntegrationTests}/FluentTests/BasicFluentAssertionTests.cs (86%) diff --git a/Terminal.sln b/Terminal.sln index 65f3d7596..cddd38cad 100644 --- a/Terminal.sln +++ b/Terminal.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.2.32427.441 MinimumVisualStudioVersion = 10.0.40219.1 @@ -62,8 +62,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StressTests", "Tests\Stress EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.Parallelizable", "Tests\UnitTestsParallelizable\UnitTests.Parallelizable.csproj", "{DE780834-190A-8277-51FD-750CC666E82D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerminalGuiFluentTesting", "TerminalGuiFluentAssertions\TerminalGuiFluentTesting.csproj", "{7C610F03-9E38-409F-9B21-A02D5569E16A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -118,10 +116,6 @@ Global {DE780834-190A-8277-51FD-750CC666E82D}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE780834-190A-8277-51FD-750CC666E82D}.Release|Any CPU.ActiveCfg = Release|Any CPU {DE780834-190A-8277-51FD-750CC666E82D}.Release|Any CPU.Build.0 = Release|Any CPU - {7C610F03-9E38-409F-9B21-A02D5569E16A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7C610F03-9E38-409F-9B21-A02D5569E16A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7C610F03-9E38-409F-9B21-A02D5569E16A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7C610F03-9E38-409F-9B21-A02D5569E16A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/TerminalGuiFluentAssertions/ClassDiagram1.cd b/TerminalGuiFluentTesting/ClassDiagram1.cd similarity index 100% rename from TerminalGuiFluentAssertions/ClassDiagram1.cd rename to TerminalGuiFluentTesting/ClassDiagram1.cd diff --git a/TerminalGuiFluentAssertions/FakeInput.cs b/TerminalGuiFluentTesting/FakeInput.cs similarity index 100% rename from TerminalGuiFluentAssertions/FakeInput.cs rename to TerminalGuiFluentTesting/FakeInput.cs diff --git a/TerminalGuiFluentAssertions/FakeNetInput.cs b/TerminalGuiFluentTesting/FakeNetInput.cs similarity index 100% rename from TerminalGuiFluentAssertions/FakeNetInput.cs rename to TerminalGuiFluentTesting/FakeNetInput.cs diff --git a/TerminalGuiFluentAssertions/FakeOutput.cs b/TerminalGuiFluentTesting/FakeOutput.cs similarity index 100% rename from TerminalGuiFluentAssertions/FakeOutput.cs rename to TerminalGuiFluentTesting/FakeOutput.cs diff --git a/TerminalGuiFluentAssertions/FakeWindowsInput.cs b/TerminalGuiFluentTesting/FakeWindowsInput.cs similarity index 100% rename from TerminalGuiFluentAssertions/FakeWindowsInput.cs rename to TerminalGuiFluentTesting/FakeWindowsInput.cs diff --git a/TerminalGuiFluentAssertions/GuiTestContext.cs b/TerminalGuiFluentTesting/GuiTestContext.cs similarity index 99% rename from TerminalGuiFluentAssertions/GuiTestContext.cs rename to TerminalGuiFluentTesting/GuiTestContext.cs index 3e6570c72..c623d9762 100644 --- a/TerminalGuiFluentAssertions/GuiTestContext.cs +++ b/TerminalGuiFluentTesting/GuiTestContext.cs @@ -1,4 +1,4 @@ -using FluentAssertions; + using Terminal.Gui; using Terminal.Gui.ConsoleDrivers; @@ -178,7 +178,11 @@ public class GuiTestContext : IDisposable where T : Toplevel, new () return this; } - public GuiTestContext Assert (AndConstraint be) { return this; } + public GuiTestContext Then (Action doAction) + { + doAction (); + return this; + } public GuiTestContext RightClick (int screenX, int screenY) { return Click (WindowsConsole.ButtonState.Button3Pressed, screenX, screenY); } diff --git a/TerminalGuiFluentAssertions/TerminalGuiFluentTesting.csproj b/TerminalGuiFluentTesting/TerminalGuiFluentTesting.csproj similarity index 79% rename from TerminalGuiFluentAssertions/TerminalGuiFluentTesting.csproj rename to TerminalGuiFluentTesting/TerminalGuiFluentTesting.csproj index 5654a7235..629e31cbe 100644 --- a/TerminalGuiFluentAssertions/TerminalGuiFluentTesting.csproj +++ b/TerminalGuiFluentTesting/TerminalGuiFluentTesting.csproj @@ -6,10 +6,6 @@ enable - - - - diff --git a/TerminalGuiFluentAssertions/With.cs b/TerminalGuiFluentTesting/With.cs similarity index 100% rename from TerminalGuiFluentAssertions/With.cs rename to TerminalGuiFluentTesting/With.cs diff --git a/Tests/UnitTests/FluentTests/BasicFluentAssertionTests.cs b/Tests/IntegrationTests/FluentTests/BasicFluentAssertionTests.cs similarity index 86% rename from Tests/UnitTests/FluentTests/BasicFluentAssertionTests.cs rename to Tests/IntegrationTests/FluentTests/BasicFluentAssertionTests.cs index 14f24a58e..edc23a070 100644 --- a/Tests/UnitTests/FluentTests/BasicFluentAssertionTests.cs +++ b/Tests/IntegrationTests/FluentTests/BasicFluentAssertionTests.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FluentAssertions; +using System.Text; +using Terminal.Gui; using TerminalGuiFluentTesting; using Xunit.Abstractions; -namespace UnitTests.FluentTests; +namespace IntegrationTests.FluentTests; public class BasicFluentAssertionTests { private readonly TextWriter _out; @@ -53,9 +49,9 @@ public class BasicFluentAssertionTests }; using var c = With.A (40, 10) .Add (lbl ) - .Assert (lbl.Frame.Width.Should().Be(38)) // Window has 2 border + .Then (()=>Assert.Same(lbl.Frame.Width,38)) // Window has 2 border .ResizeConsole (20,20) - .Assert (lbl.Frame.Width.Should ().Be (18)) + .Then (() => Assert.Same (lbl.Frame.Width, 18)) .Stop (); } diff --git a/Tests/IntegrationTests/IntegrationTests.csproj b/Tests/IntegrationTests/IntegrationTests.csproj index 94b97b6a0..f279e21df 100644 --- a/Tests/IntegrationTests/IntegrationTests.csproj +++ b/Tests/IntegrationTests/IntegrationTests.csproj @@ -26,6 +26,7 @@ + diff --git a/Tests/UnitTests/UnitTests.csproj b/Tests/UnitTests/UnitTests.csproj index 9fa09fcad..fa8470749 100644 --- a/Tests/UnitTests/UnitTests.csproj +++ b/Tests/UnitTests/UnitTests.csproj @@ -45,7 +45,6 @@ -