From c1841188df4f312ec185a61058a383dac3ee42a7 Mon Sep 17 00:00:00 2001 From: Jason Elie Bou Kheir <5115126+jasonboukheir@users.noreply.github.com> Date: Fri, 25 Nov 2022 16:30:59 -0800 Subject: [PATCH] docs(dotnet): add warning for using dotnet sdk clients with WebGL builds --- .../integration_with_the_dotnet_sdk.md | 3 +++ .../DotnetSdk/Algod/DotnetAlgodClientTest.cs | 21 ++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Documentation~/integration_with_the_dotnet_sdk.md b/Documentation~/integration_with_the_dotnet_sdk.md index bda5d9b83..a33ebd7dd 100644 --- a/Documentation~/integration_with_the_dotnet_sdk.md +++ b/Documentation~/integration_with_the_dotnet_sdk.md @@ -2,6 +2,9 @@ This SDK embeds the latest [.NET Algorand SDK](https://github.com/FrankSzendzielarz/dotnet-algorand-sdk) for usage with its models and classes. Most models and clients in the `Algorand.Unity.Algod` and `Algorand.Unity.Indexer` namespace have explicit conversions to corresponding models and apis in the `Algorand.Algod` and `Algorand.Indexer` namespaces. +> [!Warning] +> Using .NET SDK client types and signing methods are not supported for the WebGL build target. + For example, you can convert `Algorand.Unity.AlgodClient` to `Algorand.Algod.DefaultApi`: ```csharp diff --git a/Tests/Runtime/Algorand.Unity.IntegrationTests/DotnetSdk/Algod/DotnetAlgodClientTest.cs b/Tests/Runtime/Algorand.Unity.IntegrationTests/DotnetSdk/Algod/DotnetAlgodClientTest.cs index f5fa7e463..e78bd4169 100644 --- a/Tests/Runtime/Algorand.Unity.IntegrationTests/DotnetSdk/Algod/DotnetAlgodClientTest.cs +++ b/Tests/Runtime/Algorand.Unity.IntegrationTests/DotnetSdk/Algod/DotnetAlgodClientTest.cs @@ -1,25 +1,22 @@ using System.Collections; +using System.Threading; using Cysharp.Threading.Tasks; using NUnit.Framework; -using UnityEngine; using UnityEngine.TestTools; [TestFixture] public class DotnetAlgodClientTest : AlgodClientTestFixture { - [Test] - public void InstantiatingClientShouldThrowNoErrors() - { - var defaultAlgod = AlgoApiClientSettings.DefaultAlgod; - var api = (Algorand.Algod.DefaultApi)defaultAlgod; - } - [UnityTest] public IEnumerator SendSimpleRequestShouldThrowNoErrors() => UniTask.ToCoroutine(async () => { - var defaultAlgod = AlgoApiClientSettings.DefaultAlgod; - var api = (Algorand.Algod.DefaultApi)defaultAlgod; +#if UNITY_WEBGL && !UNITY_EDITOR + Assert.Ignore("HttpClient is not supported in WebGL"); +#else + SynchronizationContext.SetSynchronizationContext(new UniTaskSynchronizationContext()); + var api = AlgoApiClientSettings.DefaultAlgod.ToDefaultApi(); var response = await api.GetStatusAsync(); - Debug.Log($"Last Round: {response.LastRound}"); + Assert.Greater(response.LastRound, 0); +#endif }); -} +} \ No newline at end of file