clear deps

This commit is contained in:
Leonid Pershin
2025-10-17 06:29:23 +03:00
parent a96d4d8067
commit b816eb5aaf
21 changed files with 7 additions and 55 deletions

View File

@@ -1,12 +1,10 @@
using ChatBot.Data;
using ChatBot.Data.Interfaces;
using ChatBot.Data.Repositories;
using ChatBot.Models.Entities;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Moq;

View File

@@ -1,15 +1,9 @@
using System.Linq;
using ChatBot.Models;
using ChatBot.Models.Configuration;
using ChatBot.Models.Dto;
using ChatBot.Services;
using ChatBot.Services.Interfaces;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using OllamaSharp.Models.Chat;

View File

@@ -1,4 +1,3 @@
using System.Linq;
using ChatBot.Common.Constants;
using ChatBot.Models.Configuration;
using ChatBot.Models.Dto;
@@ -7,7 +6,6 @@ using ChatBot.Services.Interfaces;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using OllamaSharp.Models.Chat;

View File

@@ -1,12 +1,9 @@
using ChatBot.Models;
using ChatBot.Models.Configuration;
using ChatBot.Models.Dto;
using ChatBot.Services;
using ChatBot.Services.Interfaces;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
namespace ChatBot.Tests.Services;

View File

@@ -1,14 +1,11 @@
using ChatBot.Data;
using ChatBot.Data.Interfaces;
using ChatBot.Data.Repositories;
using ChatBot.Models;
using ChatBot.Models.Entities;
using ChatBot.Services;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Moq;

View File

@@ -1,4 +1,3 @@
using System.Linq;
using ChatBot.Models.Configuration;
using ChatBot.Services.HealthChecks;
using ChatBot.Services.Interfaces;
@@ -8,7 +7,6 @@ using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using OllamaSharp.Models.Chat;
namespace ChatBot.Tests.Services.HealthChecks;
@@ -16,7 +14,6 @@ public class OllamaHealthCheckTests : UnitTestBase
{
private readonly Mock<ILogger<OllamaHealthCheck>> _loggerMock;
private readonly Mock<IOllamaClient> _ollamaClientMock;
private readonly Mock<IOptions<OllamaSettings>> _optionsMock;
private readonly OllamaHealthCheck _healthCheck;
public OllamaHealthCheckTests()
@@ -24,9 +21,6 @@ public class OllamaHealthCheckTests : UnitTestBase
_loggerMock = TestDataBuilder.Mocks.CreateLoggerMock<OllamaHealthCheck>();
_ollamaClientMock = TestDataBuilder.Mocks.CreateOllamaClientMock();
var ollamaSettings = TestDataBuilder.Configurations.CreateOllamaSettings();
_optionsMock = TestDataBuilder.Mocks.CreateOptionsMock(ollamaSettings);
_healthCheck = new OllamaHealthCheck(_ollamaClientMock.Object, _loggerMock.Object);
}

View File

@@ -1,11 +1,9 @@
using ChatBot.Models.Configuration;
using ChatBot.Services.HealthChecks;
using ChatBot.Services.Interfaces;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using Telegram.Bot.Types;

View File

@@ -1,4 +1,3 @@
using System.Linq;
using ChatBot.Models.Configuration;
using ChatBot.Models.Dto;
using ChatBot.Services;
@@ -6,7 +5,6 @@ using ChatBot.Services.Interfaces;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using OllamaSharp.Models.Chat;

View File

@@ -3,7 +3,6 @@ using ChatBot.Services;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
namespace ChatBot.Tests.Services;

View File

@@ -1,11 +1,7 @@
using ChatBot.Models;
using ChatBot.Models.Configuration;
using ChatBot.Services;
using ChatBot.Services.Interfaces;
using ChatBot.Services.Telegram.Commands;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Moq;
namespace ChatBot.Tests.Telegram.Commands;

View File

@@ -1,4 +1,3 @@
using ChatBot.Services;
using ChatBot.Services.Telegram.Commands;
using ChatBot.Services.Telegram.Interfaces;
using ChatBot.Tests.TestUtilities;

View File

@@ -1,4 +1,3 @@
using ChatBot.Models.Configuration;
using ChatBot.Services;
using ChatBot.Services.Telegram.Commands;
using ChatBot.Services.Telegram.Interfaces;
@@ -6,7 +5,6 @@ using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Moq;
using Telegram.Bot.Types;
namespace ChatBot.Tests.Telegram.Commands;

View File

@@ -4,9 +4,7 @@ using ChatBot.Services.Interfaces;
using ChatBot.Services.Telegram.Commands;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Moq;
using Telegram.Bot.Types;
namespace ChatBot.Tests.Telegram.Commands;

View File

@@ -1,11 +1,8 @@
using ChatBot.Models.Configuration;
using ChatBot.Services;
using ChatBot.Services.Telegram.Commands;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Moq;
using Telegram.Bot.Types;
namespace ChatBot.Tests.Telegram.Commands;

View File

@@ -1,11 +1,9 @@
using System.Linq;
using ChatBot.Models.Configuration;
using ChatBot.Services;
using ChatBot.Services.Interfaces;
using ChatBot.Services.Telegram.Commands;
using ChatBot.Tests.TestUtilities;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using OllamaSharp.Models.Chat;

View File

@@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Moq;
@@ -10,6 +9,8 @@ namespace ChatBot.Tests.TestUtilities;
/// </summary>
public abstract class TestBase : IDisposable
{
private bool _disposed;
protected IServiceProvider ServiceProvider { get; private set; } = null!;
protected Mock<ILogger> LoggerMock { get; private set; } = null!;
@@ -30,17 +31,18 @@ public abstract class TestBase : IDisposable
protected abstract void ConfigureServices(IServiceCollection services);
protected virtual void Cleanup()
protected virtual void Dispose(bool disposing)
{
if (ServiceProvider is IDisposable disposable)
if (!_disposed && disposing && ServiceProvider is IDisposable disposable)
{
disposable.Dispose();
}
_disposed = true;
}
public void Dispose()
{
Cleanup();
Dispose(true);
GC.SuppressFinalize(this);
}
}

View File

@@ -1,5 +1,4 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable

View File

@@ -1,8 +1,5 @@
using ChatBot.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace ChatBot.Services
{

View File

@@ -1,4 +1,3 @@
using System.Net.Security;
using ChatBot.Services.Interfaces;
using OllamaSharp;
using OllamaSharp.Models;

View File

@@ -1,6 +1,4 @@
using System.Linq;
using ChatBot.Models.Configuration;
using ChatBot.Services;
using ChatBot.Services.Interfaces;
using Microsoft.Extensions.Options;

View File

@@ -1,6 +1,4 @@
using ChatBot.Services.Telegram.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Telegram.Bot;
using Telegram.Bot.Polling;
using Telegram.Bot.Types;