Files
Heimdall/tests/Heimdall.Web.Tests/Controllers/PlateRecognitionControllerTests.cs
T

26 lines
964 B
C#
Raw Normal View History

using Heimdall.Api.Controllers;
using Heimdall.Application.Services;
using Heimdall.Infrastructure.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using NSubstitute;
using Xunit;
namespace Heimdall.Web.Tests.Controllers;
public sealed class PlateRecognitionControllerTests
{
[Fact]
public async Task Recognition_is_disabled_by_default_and_does_not_call_OCR()
{
var config = Substitute.For<IOptionsMonitor<PlateOcrOptions>>();
config.CurrentValue.Returns(new PlateOcrOptions());
var service = Substitute.For<ILicensePlateRecognitionService>();
var controller = new PlateRecognitionController(null!, service, config);
var result = await controller.Recognize(Guid.NewGuid(), null, CancellationToken.None);
Assert.Equal(503, Assert.IsType<ObjectResult>(result).StatusCode);
await service.DidNotReceiveWithAnyArgs().RecognizeAsync(default, default, default);
}
}