Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit 453d2a7

Browse files
committed
Merge branch 'develop'
2 parents 29d798f + 7fbb0e5 commit 453d2a7

27 files changed

Lines changed: 372 additions & 114 deletions

File tree

ReversoAPI.Web.Tests/Clients/SpellingClientTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using ReversoAPI.Web.GrammarCheckFeature.Application.Services;
1212
using ReversoAPI.Web.Shared.Infrastructure.Http;
1313
using ReversoAPI.Web.Shared.Infrastructure.Http.Interfaces;
14+
using System.Net;
1415

1516
namespace ReversoAPI.Web.Tests.Clients
1617
{
@@ -22,15 +23,15 @@ public class SpellingClientTests
2223
public SpellingClientTests()
2324
{
2425
_apiConnector = new Mock<IAPIConnector>();
25-
_client = new SpellingService(_apiConnector.Object);
26+
_client = new SpellingService(_apiConnector.Object, null);
2627
}
2728

2829
[Theory]
2930
[MemberData(nameof(SpellingDataForTest))]
3031
public async Task GetAsync_Success(string text, Language language, Locale locale, Stream json, SpellingData expectedResult)
3132
{
3233
// Arrange
33-
var response = new HttpResponse() { Content = json };
34+
var response = new HttpResponse("text/html", json, HttpStatusCode.OK);
3435
_apiConnector
3536
.Setup(c => c.PostAsync(It.IsAny<Uri>(), It.IsAny<SpellingRequest>(), It.IsAny<CancellationToken>()))
3637
.ReturnsAsync(response);

ReversoAPI.Web.Tests/Clients/TranslationClientTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using FluentAssertions;
44
using System;
55
using System.IO;
6+
using System.Net;
67
using System.Threading;
78
using System.Threading.Tasks;
89
using System.Collections.Generic;
@@ -22,15 +23,15 @@ public class TranslationClientTests
2223
public TranslationClientTests()
2324
{
2425
_apiConnector = new Mock<IAPIConnector>();
25-
_client = new TranslationService(_apiConnector.Object);
26+
_client = new TranslationService(_apiConnector.Object, null);
2627
}
2728

2829
[Theory]
2930
[MemberData(nameof(SpellingDataForTest))]
3031
public async Task GetFromOneWordAsync_Success(string text, Language source, Language target, Stream json, TranslationData expectedResult)
3132
{
3233
// Arrange
33-
var response = new HttpResponse() { Content = json };
34+
var response = new HttpResponse("text/html", json, HttpStatusCode.OK);
3435
_apiConnector
3536
.Setup(c => c.PostAsync(It.IsAny<Uri>(), It.IsAny<TranslationRequest>(), It.IsAny<CancellationToken>()))
3637
.ReturnsAsync(response);

ReversoAPI.Web.Tests/Parsers/ConjugationResponseParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ConjugationResponseParserTest
1414
public void Invoke_Test(ConjugationData expectedResult, Stream html)
1515
{
1616
// Arrange
17-
var parser = new ConjugationParserService();
17+
var parser = new ConjugationParseService(null);
1818

1919
// Act
2020
var result = parser.Invoke(html);

ReversoAPI.Web.Tests/Parsers/ContextResponseParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ContextResponseParserTest
1414
public void Invoke_Test(ContextData expectedResult, Stream html)
1515
{
1616
// Arrange
17-
var parser = new ContextParserService();
17+
var parser = new ContextParseService(null);
1818

1919
// Act
2020
var result = parser.Invoke(html);

ReversoAPI.Web.Tests/Parsers/SynonymsResponseParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class SynonymsResponseParserTest
1414
public void Invoke_Test(SynonymsData expectedResult, Stream html)
1515
{
1616
// Arrange
17-
var parser = new SynonymsParserService();
17+
var parser = new SynonymsParseService(null);
1818

1919
// Act
2020
var result = parser.Invoke(html);

ReversoAPI.Web/ConjugationFeature/Application/Services/ConjugationService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public class ConjugationService : IConjugationService
1414
private string ConjugationURL = "https://conjugator.reverso.net/conjugation-";
1515

1616
private readonly IAPIConnector _apiConnector;
17-
private readonly IParser<ConjugationData> _parser;
17+
private readonly IParseService<ConjugationData> _parser;
1818

1919
public ConjugationService(
2020
IAPIConnector apiConnector,
21-
IParser<ConjugationData> parser)
21+
IParseService<ConjugationData> parser)
2222
{
2323
_apiConnector = apiConnector;
2424
_parser = parser;

ReversoAPI.Web/ConjugationFeature/Domain/Core/Services/ConjugationParserService.cs renamed to ReversoAPI.Web/ConjugationFeature/Domain/Core/Services/ConjugationParseService.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
using System.IO;
22
using ReversoAPI.Web.ConjugationFeature.Domain.Supporting.Builders;
33
using ReversoAPI.Web.Shared.Domain.Services;
4+
using ReversoAPI.Web.Shared.Infrastructure.Logger;
45

56
namespace ReversoAPI.Web.ConjugationFeature.Domain.Core.Services
67
{
7-
public class ConjugationParserService : BaseParser<ConjugationData>
8+
public class ConjugationParseService : BaseParser<ConjugationData>
89
{
10+
private readonly ILogger _log;
11+
12+
public ConjugationParseService(ILogger log)
13+
{
14+
_log = log;
15+
}
16+
917
protected override ConjugationData Parse(Stream htmlStream)
1018
{
1119
try
@@ -16,8 +24,9 @@ protected override ConjugationData Parse(Stream htmlStream)
1624
.WithConjugations()
1725
.Build();
1826
}
19-
catch (ParsingException)
27+
catch (ParsingException ex)
2028
{
29+
_log?.Error(ex.Message);
2130
return null;
2231
}
2332
}

ReversoAPI.Web/ContextFeature/Application/Services/ContextService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ public class ContextService : IContextService
1212
private const string ContextURL = "https://context.reverso.net/translation/";
1313

1414
private readonly IAPIConnector _apiConnector;
15-
private readonly IParser<ContextData> _parser;
15+
private readonly IParseService<ContextData> _parser;
1616

1717
public ContextService(IAPIConnector apiConnector,
18-
IParser<ContextData> parser)
18+
IParseService<ContextData> parser)
1919
{
2020
_apiConnector = apiConnector;
2121
_parser = parser;

ReversoAPI.Web/ContextFeature/Domain/Core/Services/ContextParserService.cs renamed to ReversoAPI.Web/ContextFeature/Domain/Core/Services/ContextParseService.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
using System.IO;
22
using ReversoAPI.Web.ContextFeature.Domain.Supporting.Builders;
33
using ReversoAPI.Web.Shared.Domain.Services;
4+
using ReversoAPI.Web.Shared.Infrastructure.Logger;
45

56
namespace ReversoAPI.Web.ContextFeature.Domain.Core.Services
67
{
7-
public class ContextParserService : BaseParser<ContextData>
8+
public class ContextParseService : BaseParser<ContextData>
89
{
10+
private readonly ILogger _log;
11+
public ContextParseService(ILogger log)
12+
{
13+
_log = log;
14+
}
15+
916
protected override ContextData Parse(Stream htmlStream)
1017
{
1118
try
@@ -16,8 +23,9 @@ protected override ContextData Parse(Stream htmlStream)
1623
.WithExamples()
1724
.Build();
1825
}
19-
catch (ParsingException)
26+
catch (ParsingException ex)
2027
{
28+
_log?.Error(ex.Message);
2129
return null;
2230
}
2331
}

ReversoAPI.Web/GrammarCheckFeature/Application/DTOs/SpellingRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public SpellingRequest(string text, Language language, Locale locale)
1717
AutoReplace = true;
1818
EnglishDialect = "indifferent";
1919
GetCorrectionDetails = true;
20-
InterfaceLanguage = "eu";
20+
InterfaceLanguage = "en";
2121
IsHtml = false;
2222
Locale = locale == ReversoAPI.Locale.None ? string.Empty : locale.ToString();
2323
Origin = "interactive";

0 commit comments

Comments
 (0)