27 lines
1008 B
C#
27 lines
1008 B
C#
using Heimdall.Api.Controllers;
|
|||
|
|
using Heimdall.Application.Services;
|
||
|
|
using Heimdall.Infrastructure.Services;
|
||
|
|
using Microsoft.AspNetCore.Mvc;
|
||
|
|
using Microsoft.Extensions.Options;
|
||
|
|
using MediatR;
|
||
|
|
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, Substitute.For<IMediator>());
|
||
|
|
|
||
|
|
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);
|
||
|
|
}
|
||
|
|
}
|