/
softailor
/
gridient
Обзор
Документация
Войти
/
softailor
/
gridient
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
backend/Gridient.Core.Tests/Controllers/HomeControllerTests.cs
37 строк
1 KB
Jenkins
Auto add
18 фев 2026, 10:19
18 фев 2026, 10:19
1e6c4f8
Код
Авторство
О чём код?
using FluentAssertions; using Gridient.Core.Controllers; using Gridient.Core.Features.Home.Queries; using MediatR; using Microsoft.AspNetCore.Mvc; using Moq; using Xunit; namespace Gridient.Core.Tests.Controllers { public class HomeControllerTests : ControllerTestBase { #region GetServiceTitle /// <summary> /// Проверяет, что HomeController.GetServiceTitle возвращает OkObjectResult и вызывает MediatR. /// </summary> [Fact] public async Task GetServiceTitle_ShouldReturnOk() { var mediatorMock = new Mock<IMediator>(); mediatorMock .Setup(m => m.Send(It.IsAny<GetServiceTitleQuery>(), It.IsAny<CancellationToken>())) .ReturnsAsync(new ServiceTitleResponse("Gridient")); var controller = new HomeController(mediatorMock.Object); SetupControllerContext(controller, "u"); var result = await controller.GetServiceTitle(CancellationToken.None); result.Should().BeOfType<OkObjectResult>(); mediatorMock.Verify(m => m.Send(It.IsAny<GetServiceTitleQuery>(), It.IsAny<CancellationToken>()), Times.Once); } #endregion } }