fix covverage
All checks were successful
SonarQube / Build and analyze (push) Successful in 3m33s

This commit is contained in:
Leonid Pershin
2025-10-21 03:17:43 +03:00
parent 2a26e84100
commit b8fc79992a
8 changed files with 837 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
using ChatBot.Services.Telegram.Services;
using FluentAssertions;
using Microsoft.Extensions.Logging;
using Moq;
using Telegram.Bot;
namespace ChatBot.Tests.Services.Telegram;
/// <summary>
/// Simple tests for BotInfoService that don't rely on mocking extension methods
/// </summary>
public class BotInfoServiceSimpleTests
{
[Fact]
public void Constructor_ShouldCreateInstance()
{
// Arrange
var botClientMock = new Mock<ITelegramBotClient>();
var loggerMock = new Mock<ILogger<BotInfoService>>();
// Act
var service = new BotInfoService(botClientMock.Object, loggerMock.Object);
// Assert
service.Should().NotBeNull();
}
[Fact]
public void IsCacheValid_InitiallyFalse()
{
// Arrange
var botClientMock = new Mock<ITelegramBotClient>();
var loggerMock = new Mock<ILogger<BotInfoService>>();
var service = new BotInfoService(botClientMock.Object, loggerMock.Object);
// Act & Assert
service.IsCacheValid().Should().BeFalse();
}
[Fact]
public void InvalidateCache_ShouldWork()
{
// Arrange
var botClientMock = new Mock<ITelegramBotClient>();
var loggerMock = new Mock<ILogger<BotInfoService>>();
var service = new BotInfoService(botClientMock.Object, loggerMock.Object);
// Act
service.InvalidateCache();
// Assert
service.IsCacheValid().Should().BeFalse();
}
}