Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test): Refactor Core directory in the Crowdin.Api.Tests #274

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions Crowdin.sln
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35303.130
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{582FDBF8-1C4D-45E8-B9FC-0E3B10510287}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{303E8173-0F2B-4F6C-A9D7-170EAB8461DE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{A73C101F-4383-42BE-B624-DB88836FE6B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crowdin.Api", "src\Crowdin.Api\Crowdin.Api.csproj", "{D71FBEB4-C2D5-4B8D-A48A-303815807DF5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crowdin.Api", "src\Crowdin.Api\Crowdin.Api.csproj", "{D71FBEB4-C2D5-4B8D-A48A-303815807DF5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crowdin.Api.Tests", "tests\Crowdin.Api.Tests\Crowdin.Api.Tests.csproj", "{304B7B61-1620-4FFF-967B-BB40F4B60F2A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crowdin.Api.UnitTesting", "tests\Crowdin.Api.UnitTesting\Crowdin.Api.UnitTesting.csproj", "{304B7B61-1620-4FFF-967B-BB40F4B60F2A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crowdin.Api.Samples", "samples\Crowdin.Api.Samples\Crowdin.Api.Samples.csproj", "{A4B9BA6F-97B1-441C-81E6-4EED514C9521}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crowdin.Api.Samples", "samples\Crowdin.Api.Samples\Crowdin.Api.Samples.csproj", "{A4B9BA6F-97B1-441C-81E6-4EED514C9521}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crowdin.Api.Samples.Actions", "samples\Crowdin.Api.Samples.Actions\Crowdin.Api.Samples.Actions.csproj", "{92F23B17-3B1C-4098-ACAD-781F1E3BBAA1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crowdin.Api.Samples.Actions", "samples\Crowdin.Api.Samples.Actions\Crowdin.Api.Samples.Actions.csproj", "{92F23B17-3B1C-4098-ACAD-781F1E3BBAA1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -24,19 +27,22 @@ Global
{D71FBEB4-C2D5-4B8D-A48A-303815807DF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D71FBEB4-C2D5-4B8D-A48A-303815807DF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D71FBEB4-C2D5-4B8D-A48A-303815807DF5}.Release|Any CPU.Build.0 = Release|Any CPU
{A4B9BA6F-97B1-441C-81E6-4EED514C9521}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4B9BA6F-97B1-441C-81E6-4EED514C9521}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4B9BA6F-97B1-441C-81E6-4EED514C9521}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4B9BA6F-97B1-441C-81E6-4EED514C9521}.Release|Any CPU.Build.0 = Release|Any CPU
{304B7B61-1620-4FFF-967B-BB40F4B60F2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{304B7B61-1620-4FFF-967B-BB40F4B60F2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{304B7B61-1620-4FFF-967B-BB40F4B60F2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{304B7B61-1620-4FFF-967B-BB40F4B60F2A}.Release|Any CPU.Build.0 = Release|Any CPU
{A4B9BA6F-97B1-441C-81E6-4EED514C9521}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4B9BA6F-97B1-441C-81E6-4EED514C9521}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4B9BA6F-97B1-441C-81E6-4EED514C9521}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4B9BA6F-97B1-441C-81E6-4EED514C9521}.Release|Any CPU.Build.0 = Release|Any CPU
{92F23B17-3B1C-4098-ACAD-781F1E3BBAA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92F23B17-3B1C-4098-ACAD-781F1E3BBAA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92F23B17-3B1C-4098-ACAD-781F1E3BBAA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92F23B17-3B1C-4098-ACAD-781F1E3BBAA1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D71FBEB4-C2D5-4B8D-A48A-303815807DF5} = {582FDBF8-1C4D-45E8-B9FC-0E3B10510287}
{304B7B61-1620-4FFF-967B-BB40F4B60F2A} = {303E8173-0F2B-4F6C-A9D7-170EAB8461DE}
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ Install via NuGet:

```
// Package Manager
Install-Package Crowdin.Api -Version 2.26.0
Install-Package Crowdin.Api -Version 2.27.0

// .Net CLI
dotnet add package Crowdin.Api --version 2.26.0
dotnet add package Crowdin.Api --version 2.27.0

// Package Reference
<PackageReference Include="Crowdin.Api" Version="2.26.0" />
<PackageReference Include="Crowdin.Api" Version="2.27.0" />

// Paket CLI
paket add Crowdin.Api --version 2.26.0
paket add Crowdin.Api --version 2.27.0
```

### Usage examples
Expand Down
2 changes: 1 addition & 1 deletion src/Crowdin.Api/Core/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Crowdin.Api.Tests")]
[assembly: InternalsVisibleTo("Crowdin.Api.UnitTesting")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // for Moq
2 changes: 1 addition & 1 deletion src/Crowdin.Api/Crowdin.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>2.26.0</Version>
<Version>2.27.0</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>8</LangVersion>

Expand Down
21 changes: 21 additions & 0 deletions src/Crowdin.Api/Translations/PreTranslationPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

using System.ComponentModel;
using JetBrains.Annotations;
using Newtonsoft.Json;

namespace Crowdin.Api.Translations
{
[PublicAPI]
public class PreTranslationPatch : PatchEntry
{
[JsonProperty("path")]
public PreTranslationPatchPath Path { get; set; }
}

[PublicAPI]
public enum PreTranslationPatchPath
{
[Description("/status")]
Status
}
}
36 changes: 36 additions & 0 deletions src/Crowdin.Api/Translations/TranslationsApiExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,42 @@ public TranslationsApiExecutor(ICrowdinApiClient apiClient, IJsonParser jsonPars
_jsonParser = jsonParser;
}

/// <summary>
/// List Pre-Translations. Documentation:
/// <a href="https://support.crowdin.com/developer/api/v2/#tag/Translations/operation/api.projects.pre-translations.getMany">Crowdin API</a>
/// <a href="https://support.crowdin.com/developer/api/v2/string-based/#tag/Translations/operation/api.projects.pre-translations.getMany">Crowdin String Based API</a>
/// <a href="https://support.crowdin.com/developer/enterprise/api/v2/#tag/Translations/operation/api.projects.pre-translations.getMany">Crowdin Enterprise API</a>
/// </summary>
[PublicAPI]
public async Task<ResponseList<PreTranslation>> ListPreTranslations(
int projectId,
int limit = 25,
int offset = 0)
{
var url = $"/projects/{projectId}/pre-translations";

IDictionary<string, string> queryParams = Utils.CreateQueryParamsFromPaging(limit, offset);
CrowdinApiResult result = await _apiClient.SendGetRequest(url, queryParams);
return _jsonParser.ParseResponseList<PreTranslation>(result.JsonObject);
}

/// <summary>
/// Edit Pre-Translation. Documentation:
/// <a href="https://support.crowdin.com/developer/api/v2/#tag/Translations/operation/api.projects.pre-translations.patch">Crowdin API</a>
/// <a href="https://support.crowdin.com/developer/api/v2/string-based/#tag/Translations/operation/api.projects.pre-translations.patch">Crowdin String Based API</a>
/// <a href="https://support.crowdin.com/developer/enterprise/api/v2/#tag/Translations/operation/api.projects.pre-translations.patch">Crowdin Enterprise API</a>
/// </summary>
[PublicAPI]
public async Task<PreTranslation> EditPreTranslation(
int projectId,
string preTranslationId,
IEnumerable<PreTranslationPatch> patches)
{
var url = $"/projects/{projectId}/pre-translations/{preTranslationId}";
CrowdinApiResult result = await _apiClient.SendPatchRequest(url, patches);
return _jsonParser.ParseResponseObject<PreTranslation>(result.JsonObject);
}

/// <summary>
/// Get pre-translation status. Documentation:
/// <a href="https://support.crowdin.com/api/v2/#tag/Translations/paths/~1projects~1{projectId}~1pre-translations~1{preTranslationId}/get">Crowdin API</a>
Expand Down

This file was deleted.

90 changes: 0 additions & 90 deletions tests/Crowdin.Api.Tests/Core/Resources/AI_Prompts.Designer.cs

This file was deleted.

66 changes: 0 additions & 66 deletions tests/Crowdin.Api.Tests/Core/Resources/AI_Reports.Designer.cs

This file was deleted.

Loading
Loading