Skip to content

Commit

Permalink
Обработчик неизвестных значений энам (#1568)
Browse files Browse the repository at this point in the history
Co-authored-by: inyutin-maxim <inyutin_maxim@mail.ru>
  • Loading branch information
Panuchi and inyutin-maxim committed Aug 11, 2023
1 parent aa860f9 commit 73e25b8
Show file tree
Hide file tree
Showing 21 changed files with 602 additions and 145 deletions.
16 changes: 16 additions & 0 deletions VkNet.Tests/Categories/Fave/FaveGetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ public void Get()
Count = 1
});

faves[1]
.Link.OldId.Should()
.Be(null);

faves[1]
.Link.LinkId.Should()
.Be("6_759823298_736260903");

faves[2]
.Link.OldId.Should()
.Be(6736260903);

faves[2]
.Link.LinkId.Should()
.Be("6736260903");

var fave = faves.FirstOrDefault();

faves.Should()
Expand Down
62 changes: 62 additions & 0 deletions VkNet.Tests/Enum/EnumSkipErrorTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using System.Linq;
using FluentAssertions;
using VkNet.Enums.StringEnums;
using VkNet.Tests.Infrastructure;
using Xunit;

namespace VkNet.Tests.Enum;

public class EnumSkipErrorTest : CategoryBaseTest
{
/// <inheritdoc />
protected override string Folder => "SkipEnum";

[Fact]
public void CheckStatus()
{
Url = "https://api.vk.com/method/asr.checkStatus";

ReadCategoryJsonPath(nameof(CheckStatus));

if (Api.DeserializationErrorHandler is not true)
{
return;
}

var result = Api.Asr.CheckStatus("7ee0fa8e-64ac-4391-af7a-5c98a6330866");

result.Id.Should()
.Be("7ee0fa8e-64ac-4391-af7a-5c98a6330866");

result.Text.Should()
.Be("Это тестовая запись для сервиса распознавания речи ВКонтакте.");

result.Status.Should()
.Be(null);
}

[Fact]
public void Get_CheckType()
{
Url = "https://api.vk.com/method/apps.get";
ReadCategoryJsonPath(nameof(Get_CheckType));

if (Api.DeserializationErrorHandler is not true)
{
return;
}

var app = Api.Apps.Get(new()
{
AppIds = new ulong[]
{
4268118
},
Platform = AppPlatforms.Web
});

app.Apps.First()
.Type.Should()
.Be(null);
}
}
1 change: 1 addition & 0 deletions VkNet.Tests/Infrastructure/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public BaseTest()
Api.RestClient = Mocker.Get<IRestClient>();
Api.NeedValidationHandler = Mocker.Get<INeedValidationHandler>();
Api.CaptchaSolver = Mocker.Get<ICaptchaSolver>();
Api.DeserializationErrorHandler = false;
SetupCaptchaHandler();

Api.Authorize(Mocker.Get<IApiAuthParams>());
Expand Down
Loading

0 comments on commit 73e25b8

Please sign in to comment.