From d3f76405e2364178f9682adb24df92e5cb2ccf1f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:47:16 +0000 Subject: [PATCH 1/3] build(deps): bump MSTest.TestFramework from 3.6.4 to 3.7.0 Bumps [MSTest.TestFramework](https://github.com/microsoft/testfx) from 3.6.4 to 3.7.0. - [Release notes](https://github.com/microsoft/testfx/releases) - [Changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md) - [Commits](https://github.com/microsoft/testfx/compare/v3.6.4...v3.7.0) --- updated-dependencies: - dependency-name: MSTest.TestFramework dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 8cc8a21..005f71e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From 27c16a1c9f5d7225dfed96ca4571b932133a07ac Mon Sep 17 00:00:00 2001 From: BoBoBaSs84 <73112377+BoBoBaSs84@users.noreply.github.com> Date: Sun, 22 Dec 2024 15:04:58 +0100 Subject: [PATCH 2/3] chore(deps): nuget package updated --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 005f71e..20da76b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + From 2d3282a661c713f68113303eb9a0bed013d8225b Mon Sep 17 00:00:00 2001 From: BoBoBaSs84 <73112377+BoBoBaSs84@users.noreply.github.com> Date: Sun, 22 Dec 2024 15:05:12 +0100 Subject: [PATCH 3/3] fix: unit tests fixed --- tests/DDS.ToolsTests/Models/DdsImageModelTests.cs | 5 +---- tests/DDS.ToolsTests/Models/PngImageModelTests.cs | 5 +---- .../Services/TodoServiceTests.GetTodos.cs | 5 ++--- .../Services/TodoServiceTests.GetTodosDone.cs | 3 +-- tests/DDS.ToolsTests/Services/TodoServiceTests.cs | 11 ++++++----- tests/DDS.ToolsTests/UnitTestBase.cs | 11 ----------- 6 files changed, 11 insertions(+), 29 deletions(-) diff --git a/tests/DDS.ToolsTests/Models/DdsImageModelTests.cs b/tests/DDS.ToolsTests/Models/DdsImageModelTests.cs index e238b30..b071047 100644 --- a/tests/DDS.ToolsTests/Models/DdsImageModelTests.cs +++ b/tests/DDS.ToolsTests/Models/DdsImageModelTests.cs @@ -12,12 +12,10 @@ public class DdsImageModelTests : UnitTestBase private static readonly string NewFilePath = Path.Combine(TestConstants.ResourcePath, "new_32a.png"); [TestCleanup] - public override void TestCleanup() + public void TestCleanup() { if (File.Exists(NewFilePath)) File.Delete(NewFilePath); - - base.TestCleanup(); } [TestMethod] @@ -27,7 +25,6 @@ public void LoadTest() image.Load(FilePath); - Assert.IsNotNull(image); Assert.AreNotEqual(string.Empty, image.Name); Assert.AreNotEqual(string.Empty, image.Path); Assert.AreNotEqual(0, image.Width); diff --git a/tests/DDS.ToolsTests/Models/PngImageModelTests.cs b/tests/DDS.ToolsTests/Models/PngImageModelTests.cs index c8c59ed..7d531d9 100644 --- a/tests/DDS.ToolsTests/Models/PngImageModelTests.cs +++ b/tests/DDS.ToolsTests/Models/PngImageModelTests.cs @@ -12,12 +12,10 @@ public sealed class PngImageModelTests : UnitTestBase private static readonly string NewFilePath = Path.Combine(TestConstants.ResourcePath, "new_32.dds"); [TestCleanup] - public override void TestCleanup() + public void TestCleanup() { if (File.Exists(NewFilePath)) File.Delete(NewFilePath); - - base.TestCleanup(); } [TestMethod] @@ -27,7 +25,6 @@ public void LoadTest() image.Load(FilePath); - Assert.IsNotNull(image); Assert.AreNotEqual(string.Empty, image.Name); Assert.AreNotEqual(string.Empty, image.Path); Assert.AreNotEqual(0, image.Width); diff --git a/tests/DDS.ToolsTests/Services/TodoServiceTests.GetTodos.cs b/tests/DDS.ToolsTests/Services/TodoServiceTests.GetTodos.cs index 07859ab..fc76ed3 100644 --- a/tests/DDS.ToolsTests/Services/TodoServiceTests.GetTodos.cs +++ b/tests/DDS.ToolsTests/Services/TodoServiceTests.GetTodos.cs @@ -8,7 +8,7 @@ namespace DDS.ToolsTests.Services; public sealed partial class TodoServiceTests { [DataTestMethod] - [DynamicData(nameof(GetTodosData))] + [DynamicData(nameof(GetTodosData), DynamicDataSourceType.Property)] public void GetTodosTest(string resourcePath, ImageType type, int expected) { DdsConvertSettings settings = new() { SourceFolder = resourcePath, TargetFolder = resourcePath }; @@ -19,7 +19,6 @@ public void GetTodosTest(string resourcePath, ImageType type, int expected) } [TestMethod] - [ExpectedException(typeof(ServiceException))] public void GetTodosSourceFolderNotFoundTest() - => s_todoService.GetTodos(new DdsConvertSettings() { SourceFolder = @"X:\FooBar" }, ImageType.DDS); + => Assert.ThrowsException(() => s_todoService.GetTodos(new DdsConvertSettings() { SourceFolder = @"X:\FooBar" }, ImageType.DDS)); } diff --git a/tests/DDS.ToolsTests/Services/TodoServiceTests.GetTodosDone.cs b/tests/DDS.ToolsTests/Services/TodoServiceTests.GetTodosDone.cs index 195b77f..d17b16c 100644 --- a/tests/DDS.ToolsTests/Services/TodoServiceTests.GetTodosDone.cs +++ b/tests/DDS.ToolsTests/Services/TodoServiceTests.GetTodosDone.cs @@ -8,9 +8,8 @@ namespace DDS.ToolsTests.Services; public sealed partial class TodoServiceTests { [TestMethod] - [ExpectedException(typeof(ServiceException))] public void GetTodosDoneExceptionTest() - => s_todoService.GetTodosDone(null!, null!, ImageType.DDS); + => Assert.ThrowsException(() => s_todoService.GetTodosDone(null!, null!, ImageType.DDS)); [TestMethod] public void GetTodosDoneTest() diff --git a/tests/DDS.ToolsTests/Services/TodoServiceTests.cs b/tests/DDS.ToolsTests/Services/TodoServiceTests.cs index 10434ce..e1eda2c 100644 --- a/tests/DDS.ToolsTests/Services/TodoServiceTests.cs +++ b/tests/DDS.ToolsTests/Services/TodoServiceTests.cs @@ -15,10 +15,11 @@ public static void ClassInitialize(TestContext context) => s_todoService = ServiceProvider.GetRequiredService(); private static IEnumerable GetTodosData - => new object[][]{ - [TestConstants.PngResourcePath, ImageType.PNG, 6], - [TestConstants.PngResourcePath, ImageType.DDS, 0], - [TestConstants.DdsResourcePath, ImageType.DDS, 6], - [TestConstants.DdsResourcePath, ImageType.PNG, 0] + => new object[][] + { + [TestConstants.PngResourcePath, ImageType.PNG, 6], + [TestConstants.PngResourcePath, ImageType.DDS, 0], + [TestConstants.DdsResourcePath, ImageType.DDS, 6], + [TestConstants.DdsResourcePath, ImageType.PNG, 0] }; } diff --git a/tests/DDS.ToolsTests/UnitTestBase.cs b/tests/DDS.ToolsTests/UnitTestBase.cs index a2fc5c1..473f957 100644 --- a/tests/DDS.ToolsTests/UnitTestBase.cs +++ b/tests/DDS.ToolsTests/UnitTestBase.cs @@ -7,24 +7,13 @@ namespace DDS.ToolsTests; [TestClass] public abstract class UnitTestBase { - private static TestContext? s_context; - [AssemblyInitialize] public static void AssemblyInitialize(TestContext context) { - s_context = context; IHost host = CreateTestHost(); ServiceProvider = host.Services; } - [TestInitialize] - public virtual void TestInitialize() - => s_context?.WriteLine($"Initialize {s_context.TestName} .."); - - [TestCleanup] - public virtual void TestCleanup() - => s_context?.WriteLine($"Cleanup {s_context.TestName} .."); - public static IServiceProvider ServiceProvider { get; private set; } = default!; private static IHost CreateTestHost()