diff --git a/tests/dotnet/Gatekeeper.Tests/Services/AzureContentSafetyServiceTests.cs b/tests/dotnet/Gatekeeper.Tests/Services/AzureContentSafetyServiceTests.cs index 9565954a5a..498913e04f 100644 --- a/tests/dotnet/Gatekeeper.Tests/Services/AzureContentSafetyServiceTests.cs +++ b/tests/dotnet/Gatekeeper.Tests/Services/AzureContentSafetyServiceTests.cs @@ -1,13 +1,10 @@ -using Azure; -using Azure.AI.ContentSafety; -using FoundationaLLM.Common.Interfaces; +using FoundationaLLM.Common.Interfaces; using FoundationaLLM.Gatekeeper.Core.Models.ConfigurationOptions; using FoundationaLLM.Gatekeeper.Core.Models.ContentSafety; using FoundationaLLM.Gatekeeper.Core.Services; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using NSubstitute; -using NSubstitute.ExceptionExtensions; namespace Gatekeeper.Tests.Services { @@ -16,18 +13,13 @@ public class AzureContentSafetyServiceTests private readonly AzureContentSafetyService _testedService; private readonly ILogger _logger = Substitute.For>(); - private ContentSafetyClient _client; - private AzureContentSafetyService _service; - + private readonly IOptions _settings = Substitute.For>(); private readonly ICallContext _callContext = Substitute.For(); private readonly IHttpClientFactoryService _httpClientFactoryService = Substitute.For(); public AzureContentSafetyServiceTests() { - // TODO: move to APIEndpointConfiguration - //_testedService = new AzureContentSafetyService(_callContext, _httpClientFactoryService, _settings, _logger); - //_client = Substitute.ForPartsOf(new Uri(_settings.Value.APIUrl), new AzureKeyCredential(_settings.Value.APIKey)); - //_service = new AzureContentSafetyService(_callContext, _httpClientFactoryService, _settings, _logger); + _testedService = new AzureContentSafetyService(_callContext, _httpClientFactoryService, _settings, _logger); } [Fact] @@ -41,9 +33,6 @@ public async Task AnalyzeText_RequestFailedException_ReturnsExpectedResult() Reason = "The content safety service was unable to validate the prompt text due to an internal error." }; - _client.AnalyzeTextAsync(Arg.Any()) - .Throws(new RequestFailedException("Test error")); - // Act var result = await _testedService.AnalyzeText(content);