From 6cee0deef1b7ee666acc680c23926a386a7b3659 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Sat, 21 Dec 2024 02:19:06 +0700 Subject: [PATCH] Remove NUnit3 project (deprecated) (#152) --- Akka.TestKit.Nunit.sln | 12 -- .../Akka.TestKit.NUnit3.Tests.csproj | 12 -- .../AssertionsTests.cs | 76 ----------- src/Akka.TestKit.NUnit3.Tests/Bugfix44Spec.cs | 27 ---- .../TestKitTestFixtureTest.cs | 29 ----- src/Akka.TestKit.NUnit3.Tests/TestKitTests.cs | 29 ----- .../Akka.TestKit.NUnit3.csproj | 15 --- src/Akka.TestKit.NUnit3/NUnitAssertions.cs | 46 ------- src/Akka.TestKit.NUnit3/TestKit.cs | 122 ------------------ 9 files changed, 368 deletions(-) delete mode 100644 src/Akka.TestKit.NUnit3.Tests/Akka.TestKit.NUnit3.Tests.csproj delete mode 100644 src/Akka.TestKit.NUnit3.Tests/AssertionsTests.cs delete mode 100644 src/Akka.TestKit.NUnit3.Tests/Bugfix44Spec.cs delete mode 100644 src/Akka.TestKit.NUnit3.Tests/TestKitTestFixtureTest.cs delete mode 100644 src/Akka.TestKit.NUnit3.Tests/TestKitTests.cs delete mode 100644 src/Akka.TestKit.NUnit3/Akka.TestKit.NUnit3.csproj delete mode 100644 src/Akka.TestKit.NUnit3/NUnitAssertions.cs delete mode 100644 src/Akka.TestKit.NUnit3/TestKit.cs diff --git a/Akka.TestKit.Nunit.sln b/Akka.TestKit.Nunit.sln index 702c493..5336e12 100644 --- a/Akka.TestKit.Nunit.sln +++ b/Akka.TestKit.Nunit.sln @@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.TestKit.NUnit", "src\A EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.TestKit.NUnit.Tests", "src\Akka.TestKit.NUnit.Tests\Akka.TestKit.NUnit.Tests.csproj", "{D63223FA-03F5-4B32-A6EC-668F718C0826}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.TestKit.NUnit3", "src\Akka.TestKit.NUnit3\Akka.TestKit.NUnit3.csproj", "{62A7BBA3-2AA6-4F9B-8ACA-15C3863C026E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Akka.TestKit.NUnit3.Tests", "src\Akka.TestKit.NUnit3.Tests\Akka.TestKit.NUnit3.Tests.csproj", "{FF91B397-1E60-4B94-99A1-B534C7BB91A5}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{873747EF-ACF9-4BB2-90C1-052BFA3C84F2}" ProjectSection(SolutionItems) = preProject README.md = README.md @@ -31,14 +27,6 @@ Global {D63223FA-03F5-4B32-A6EC-668F718C0826}.Debug|Any CPU.Build.0 = Debug|Any CPU {D63223FA-03F5-4B32-A6EC-668F718C0826}.Release|Any CPU.ActiveCfg = Release|Any CPU {D63223FA-03F5-4B32-A6EC-668F718C0826}.Release|Any CPU.Build.0 = Release|Any CPU - {62A7BBA3-2AA6-4F9B-8ACA-15C3863C026E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {62A7BBA3-2AA6-4F9B-8ACA-15C3863C026E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {62A7BBA3-2AA6-4F9B-8ACA-15C3863C026E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {62A7BBA3-2AA6-4F9B-8ACA-15C3863C026E}.Release|Any CPU.Build.0 = Release|Any CPU - {FF91B397-1E60-4B94-99A1-B534C7BB91A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FF91B397-1E60-4B94-99A1-B534C7BB91A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FF91B397-1E60-4B94-99A1-B534C7BB91A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FF91B397-1E60-4B94-99A1-B534C7BB91A5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Akka.TestKit.NUnit3.Tests/Akka.TestKit.NUnit3.Tests.csproj b/src/Akka.TestKit.NUnit3.Tests/Akka.TestKit.NUnit3.Tests.csproj deleted file mode 100644 index e4d6179..0000000 --- a/src/Akka.TestKit.NUnit3.Tests/Akka.TestKit.NUnit3.Tests.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - net6.0;net462 - - - - - - - - - diff --git a/src/Akka.TestKit.NUnit3.Tests/AssertionsTests.cs b/src/Akka.TestKit.NUnit3.Tests/AssertionsTests.cs deleted file mode 100644 index 2dfee3f..0000000 --- a/src/Akka.TestKit.NUnit3.Tests/AssertionsTests.cs +++ /dev/null @@ -1,76 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//---------------------------------------------------------------------- - -using NUnit.Framework; - -namespace Akka.TestKit.NUnit3.Tests -{ - [Parallelizable(ParallelScope.All)] - public class AssertionsTests : TestKit - { - private readonly NUnitAssertions _assertions; - - public AssertionsTests() - { - _assertions = new NUnitAssertions(); - } - - [Test] - public void Fail_should_throw() - { - Assert.Throws(() => _assertions.Fail()); - } - - [Test] - public void AssertTrue_should_throw_on_false() - { - Assert.Throws(() => _assertions.AssertTrue(false)); - } - - [Test] - public void AssertTrue_should_succeed_on_true() - { - _assertions.AssertTrue(true); - } - - [Test] - public void AssertFalse_should_throw_on_true() - { - Assert.Throws(() => _assertions.AssertFalse(true)); - } - - [Test] - public void AssertFalse_should_succeed_on_false() - { - _assertions.AssertFalse(false); - } - - [Test] - public void AssertEqual_should_throw_on_not_equal() - { - Assert.Throws(() => _assertions.AssertEqual(42, 4711)); - } - - [Test] - public void AssertEqual_should_succeed_on_equal() - { - _assertions.AssertEqual(42, 42); - } - - [Test] - public void AssertEqualWithComparer_should_throw_on_not_equal() - { - Assert.Throws(() => _assertions.AssertEqual(42, 42, (x, y) => false)); - } - - [Test] - public void AssertEqualWithComparer_should_succeed_on_equal() - { - _assertions.AssertEqual(42, 4711, (x, y) => true); - } - } -} diff --git a/src/Akka.TestKit.NUnit3.Tests/Bugfix44Spec.cs b/src/Akka.TestKit.NUnit3.Tests/Bugfix44Spec.cs deleted file mode 100644 index fbbee02..0000000 --- a/src/Akka.TestKit.NUnit3.Tests/Bugfix44Spec.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Akka.Actor; -using NUnit.Framework; - -namespace Akka.TestKit.NUnit3.Tests; - -[TestFixture] -public class Bugfix44Spec : TestKit -{ - // need to have the DefaultConfig for the TestKit with this ActorSystem - public Bugfix44Spec() : base(ActorSystem.Create("Foo", TestKit.DefaultConfig)) - { - - } - - [Test] - public void Should_use_provided_ActorSystem() - { - Assertions.AssertEqual("Foo",Sys.Name); - } - - [Test] - public void Should_use_provided_ActorSystem_again() - { - // Technically this will be a second, different ActorSystem but the names should be the same - Assertions.AssertEqual("Foo",Sys.Name); - } -} \ No newline at end of file diff --git a/src/Akka.TestKit.NUnit3.Tests/TestKitTestFixtureTest.cs b/src/Akka.TestKit.NUnit3.Tests/TestKitTestFixtureTest.cs deleted file mode 100644 index f5e4174..0000000 --- a/src/Akka.TestKit.NUnit3.Tests/TestKitTestFixtureTest.cs +++ /dev/null @@ -1,29 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//---------------------------------------------------------------------- - -using Akka.Actor; -using Akka.TestKit.TestActors; -using NUnit.Framework; - -namespace Akka.TestKit.NUnit3.Tests -{ - [Parallelizable(ParallelScope.All)] - public class TestKitTestFixtureTest : TestKit - { - [Test] - public void Can_create_more_than_one_test_in_a_fixture_with_the_same_actor_name_test1() - { - Sys.ActorOf("actor-name"); - } - - [Test] - public void Can_create_more_than_one_test_in_a_fixture_with_the_same_actor_name_test2() - { - Sys.ActorOf("actor-name"); - } - } -} \ No newline at end of file diff --git a/src/Akka.TestKit.NUnit3.Tests/TestKitTests.cs b/src/Akka.TestKit.NUnit3.Tests/TestKitTests.cs deleted file mode 100644 index 5df7622..0000000 --- a/src/Akka.TestKit.NUnit3.Tests/TestKitTests.cs +++ /dev/null @@ -1,29 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//---------------------------------------------------------------------- - -using Akka.Actor; -using NUnit.Framework; - -namespace Akka.TestKit.NUnit3.Tests -{ - [Parallelizable(ParallelScope.All)] - public class TestKitTests : TestKit - { - [TearDown] - public void Cleanup() - { - Shutdown(); - } - - [Test] - public void Expect_a_message() - { - TestActor.Tell("Test"); - ExpectMsg("Test"); - } - } -} \ No newline at end of file diff --git a/src/Akka.TestKit.NUnit3/Akka.TestKit.NUnit3.csproj b/src/Akka.TestKit.NUnit3/Akka.TestKit.NUnit3.csproj deleted file mode 100644 index dfba4fd..0000000 --- a/src/Akka.TestKit.NUnit3/Akka.TestKit.NUnit3.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - netstandard2.0 - true - - - - - - - - diff --git a/src/Akka.TestKit.NUnit3/NUnitAssertions.cs b/src/Akka.TestKit.NUnit3/NUnitAssertions.cs deleted file mode 100644 index 421c78e..0000000 --- a/src/Akka.TestKit.NUnit3/NUnitAssertions.cs +++ /dev/null @@ -1,46 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; -using NUnit.Framework; - -#pragma warning disable NUnit2050 // NUnit 4 no longer supports string.Format specification - -namespace Akka.TestKit.NUnit3 -{ - /// - /// Assertions for NUnit - /// - public class NUnitAssertions : ITestKitAssertions - { - - public void Fail(string format = "", params object[] args) - { - Assert.Fail(format, args); - } - - public void AssertTrue(bool condition, string format = "", params object[] args) - { - Assert.That(condition, Is.True, format, args); - } - - public void AssertFalse(bool condition, string format = "", params object[] args) - { - Assert.That(condition, Is.False, format, args); - } - - public void AssertEqual(T expected, T actual, string format = "", params object[] args) - { - Assert.That(actual, Is.EqualTo(expected), format, args); - } - - public void AssertEqual(T expected, T actual, Func comparer, string format = "", params object[] args) - { - Assert.That(actual, Is.EqualTo(expected).Using(comparer), format, args); - } - } -} diff --git a/src/Akka.TestKit.NUnit3/TestKit.cs b/src/Akka.TestKit.NUnit3/TestKit.cs deleted file mode 100644 index 5483970..0000000 --- a/src/Akka.TestKit.NUnit3/TestKit.cs +++ /dev/null @@ -1,122 +0,0 @@ -//----------------------------------------------------------------------- -// -// Copyright (C) 2009-2016 Typesafe Inc. -// Copyright (C) 2013-2016 Akka.NET project -// -//----------------------------------------------------------------------- - -using System; -using Akka.Actor; -using Akka.Configuration; -using NUnit.Framework; - -namespace Akka.TestKit.NUnit3 -{ - /// - /// TestKit for NUnit. - /// - /// - [TestFixture] - [FixtureLifeCycle(LifeCycle.InstancePerTestCase)] - public class TestKit : TestKitBase, IDisposable - { - private static readonly NUnitAssertions _assertions = new NUnitAssertions(); - private readonly Config _config; - private readonly string _actorSystemName; - private bool _isDisposed; //Automatically initialized to false; - - /// - /// Create a new instance of the for NUnit class. - /// If no is passed in, a new system - /// with will be created. - /// - /// Optional: The actor system. - public TestKit(ActorSystem system = null) - : base(_assertions, system) - { - } - - /// - /// Create a new instance of the for NUnit class. - /// A new system with the specified configuration will be created. - /// - /// The configuration to use for the system. - /// Optional: the name of the system. Default: "test" - public TestKit(Config config, string actorSystemName = null) - : base(_assertions, config, actorSystemName) - { - _config = config; - _actorSystemName = actorSystemName; - } - - - /// - /// Create a new instance of the for NUnit class. - /// A new system with the specified configuration will be created. - /// - /// The configuration to use for the system. - public TestKit(string config) - : base(_assertions, ConfigurationFactory.ParseString(config)) - { - _config = ConfigurationFactory.ParseString(config); - } - - public new static Config DefaultConfig { get { return TestKitBase.DefaultConfig; } } - public new static Config FullDebugConfig { get { return TestKitBase.FullDebugConfig; } } - - protected static NUnitAssertions Assertions { get { return _assertions; } } - - /// - /// This method is called after each test finishes, which calls - /// into the AfterAll method. - /// - [TearDown] - public void ShutDownActorSystemOnTearDown() - { - AfterAll(); - } - - /// - /// This method is called when a test ends. - /// If you override this, make sure you either call - /// base.AfterTest() or TestKitBase.Shutdown to shut down - /// the system. Otherwise you'll leak memory. - /// - /// - protected virtual void AfterAll() - { - Shutdown(); - } - - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - public void Dispose() - { - Dispose(true); - //Take this object off the finalization queue and prevent finalization code for this object - //from executing a second time. - GC.SuppressFinalize(this); - } - - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// if set to true the method has been called directly or indirectly by a - /// user's code. Managed and unmanaged resources will be disposed.
- /// if set to false the method has been called by the runtime from inside the finalizer and only - /// unmanaged resources can be disposed. - protected virtual void Dispose(bool disposing) - { - // If disposing equals false, the method has been called by the - // runtime from inside the finalizer and you should not reference - // other objects. Only unmanaged resources can be disposed. - - //Make sure Dispose does not get called more than once, by checking the disposed field - if (!_isDisposed) - { - if (disposing) - { - AfterAll(); - } - } - _isDisposed = true; - } - } -}