From c462d065f48e22957aa525c5a96a6301f2908929 Mon Sep 17 00:00:00 2001 From: Artemy <109195690+stalcker2288969@users.noreply.github.com> Date: Tue, 4 Nov 2025 11:51:37 +0700 Subject: [PATCH] [TearDown] added --- Govor.API.Tests/Controllers/SessionControllerTests.cs | 6 ++++++ Govor.API.Tests/Hubs/PresenceHubTests.cs | 7 +++++++ .../Controllers/ChatLoadControllerTests.cs | 6 ++++++ .../Controllers/FriendsRequestQueryControllerTests.cs | 6 ++++++ .../Controllers/OnlinePingingControllerTests.cs | 7 +++++++ .../Controllers/RefreshControllerTests.cs | 7 +++++++ Govor.API.Tests/IntegrationTests/Hubs/ChatsHubTests.cs | 8 ++++++++ Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs | 6 ++++++ .../Services/PingHandlerServiceTests.cs | 7 +++++++ 9 files changed, 60 insertions(+) diff --git a/Govor.API.Tests/Controllers/SessionControllerTests.cs b/Govor.API.Tests/Controllers/SessionControllerTests.cs index 0d1f2ff..f3190db 100644 --- a/Govor.API.Tests/Controllers/SessionControllerTests.cs +++ b/Govor.API.Tests/Controllers/SessionControllerTests.cs @@ -380,4 +380,10 @@ public class SessionControllerTests It.IsAny>()), Times.Once()); } #endregion + + [TearDown] + public void TearDown() + { + _controller?.Dispose(); + } } \ No newline at end of file diff --git a/Govor.API.Tests/Hubs/PresenceHubTests.cs b/Govor.API.Tests/Hubs/PresenceHubTests.cs index 316c00f..032a1e6 100644 --- a/Govor.API.Tests/Hubs/PresenceHubTests.cs +++ b/Govor.API.Tests/Hubs/PresenceHubTests.cs @@ -4,6 +4,7 @@ using Govor.API.Hubs; using Govor.Application.Interfaces.UserOnlineStatus; using Govor.Core.Models.Users; using Govor.Core.Repositories.Users; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; using Moq; @@ -186,4 +187,10 @@ public class PresenceHubTests It.IsAny()), Times.Never); } + + [TearDown] + public void TearDown() + { + _hub?.Dispose(); + } } \ No newline at end of file diff --git a/Govor.API.Tests/IntegrationTests/Controllers/ChatLoadControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/ChatLoadControllerTests.cs index a8315a0..bc5fb08 100644 --- a/Govor.API.Tests/IntegrationTests/Controllers/ChatLoadControllerTests.cs +++ b/Govor.API.Tests/IntegrationTests/Controllers/ChatLoadControllerTests.cs @@ -257,4 +257,10 @@ public class ChatLoadControllerTests // Assert Assert.That(result, Is.InstanceOf()); } + + [TearDown] + public void TearDown() + { + _controller?.Dispose(); + } } \ No newline at end of file diff --git a/Govor.API.Tests/IntegrationTests/Controllers/FriendsRequestQueryControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/FriendsRequestQueryControllerTests.cs index 41b0c58..1d2b6c1 100644 --- a/Govor.API.Tests/IntegrationTests/Controllers/FriendsRequestQueryControllerTests.cs +++ b/Govor.API.Tests/IntegrationTests/Controllers/FriendsRequestQueryControllerTests.cs @@ -199,4 +199,10 @@ public class FriendsRequestQueryControllerTests var objectResult = result as ObjectResult; Assert.That(objectResult.StatusCode, Is.EqualTo(500)); } + + [TearDown] + public void TearDown() + { + _controller?.Dispose(); + } } \ No newline at end of file diff --git a/Govor.API.Tests/IntegrationTests/Controllers/OnlinePingingControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/OnlinePingingControllerTests.cs index e68ae43..0133572 100644 --- a/Govor.API.Tests/IntegrationTests/Controllers/OnlinePingingControllerTests.cs +++ b/Govor.API.Tests/IntegrationTests/Controllers/OnlinePingingControllerTests.cs @@ -112,6 +112,13 @@ public class OnlinePingingControllerTests _loggerMock.VerifyLog(LogLevel.Error, exception.Message, Times.Once()); _pingHandlerServiceMock.Verify(x => x.Ping(It.IsAny()), Times.Never()); } + + + [TearDown] + public void TearDown() + { + _controller?.Dispose(); + } } // Helper extension for verifying logger calls diff --git a/Govor.API.Tests/IntegrationTests/Controllers/RefreshControllerTests.cs b/Govor.API.Tests/IntegrationTests/Controllers/RefreshControllerTests.cs index 2ab1195..31c41f8 100644 --- a/Govor.API.Tests/IntegrationTests/Controllers/RefreshControllerTests.cs +++ b/Govor.API.Tests/IntegrationTests/Controllers/RefreshControllerTests.cs @@ -114,4 +114,11 @@ public class RefreshControllerTests // Assert Assert.That(result, Is.InstanceOf()); } + + + [TearDown] + public void TearDown() + { + _controller?.Dispose(); + } } \ No newline at end of file diff --git a/Govor.API.Tests/IntegrationTests/Hubs/ChatsHubTests.cs b/Govor.API.Tests/IntegrationTests/Hubs/ChatsHubTests.cs index a57b78c..01ce8af 100644 --- a/Govor.API.Tests/IntegrationTests/Hubs/ChatsHubTests.cs +++ b/Govor.API.Tests/IntegrationTests/Hubs/ChatsHubTests.cs @@ -3,6 +3,7 @@ using Govor.API.Common.SignalR.Helpers; using Govor.API.Hubs; using Govor.Application.Interfaces; using Govor.Application.Interfaces.Messages; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Moq; @@ -44,4 +45,11 @@ public class ChatsHubTests { } + + + [TearDown] + public void TearDown() + { + _chatsHub?.Dispose(); + } } \ No newline at end of file diff --git a/Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs b/Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs index ce1963c..e0ee94d 100644 --- a/Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs +++ b/Govor.API.Tests/IntegrationTests/Hubs/FriendsHubTests.cs @@ -335,4 +335,10 @@ public class FriendsHubTests Assert.That(result.Status, Is.EqualTo(HubResultStatus.ServerError)); Assert.That(result.ErrorMessage, Is.EqualTo("Unexpected error! Please try later!")); } + + [TearDown] + public void TearDown() + { + _hub?.Dispose(); + } } diff --git a/Govor.Application.Tests/Services/PingHandlerServiceTests.cs b/Govor.Application.Tests/Services/PingHandlerServiceTests.cs index d59e6ec..09762ad 100644 --- a/Govor.Application.Tests/Services/PingHandlerServiceTests.cs +++ b/Govor.Application.Tests/Services/PingHandlerServiceTests.cs @@ -55,4 +55,11 @@ public class PingHandlerServiceTests // Assert Assert.That(updatedUser.WasOnline, Is.EqualTo(originalTime)); } + + [TearDown] + public void TearDown() + { + _dbContext?.Dispose(); + _memoryCache?.Dispose(); + } }