From dface29ff265812989e225e5b51a83433ba1353c Mon Sep 17 00:00:00 2001 From: Savya Bikram Shah <54802693+Savya-lol@users.noreply.github.com> Date: Thu, 7 May 2026 17:43:55 +0545 Subject: [PATCH] Delete Packages/com.voidbotz.fonepayunity/Tests/Runtime directory --- .../Tests/Runtime/FonepayRuntimeTests.cs | 91 ------------------- 1 file changed, 91 deletions(-) delete mode 100644 Packages/com.voidbotz.fonepayunity/Tests/Runtime/FonepayRuntimeTests.cs diff --git a/Packages/com.voidbotz.fonepayunity/Tests/Runtime/FonepayRuntimeTests.cs b/Packages/com.voidbotz.fonepayunity/Tests/Runtime/FonepayRuntimeTests.cs deleted file mode 100644 index 85a316a..0000000 --- a/Packages/com.voidbotz.fonepayunity/Tests/Runtime/FonepayRuntimeTests.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections; -using System.Threading; -using System.Threading.Tasks; -using Darkmatter.Fonepay; -using NUnit.Framework; -using UnityEngine; -using UnityEngine.TestTools; - -namespace Darkmatter.FonepayUnity.Tests -{ - public class WebsocketMessagePlayModeTests - { - [Test] - public void Status_ParsesNestedJsonInPlayer() - { - const string raw = - "{\"transactionStatus\":\"{\\\"paymentSuccess\\\":true,\\\"success\\\":true,\\\"amount\\\":7}\"}"; - - var envelope = JsonUtility.FromJson>(raw); - var status = envelope.Status; - - Assert.IsTrue(status.paymentSuccess); - Assert.AreEqual(7f, status.amount); - Assert.AreEqual(PaymentOutcome.Complete, status.Outcome); - } - - [Test] - public void Status_ReparsesEachAccess() - { - const string raw = - "{\"transactionStatus\":\"{\\\"success\\\":true,\\\"paymentSuccess\\\":true}\"}"; - - var envelope = JsonUtility.FromJson>(raw); - var a = envelope.Status; - var b = envelope.Status; - - Assert.AreEqual(a.Outcome, b.Outcome); - Assert.AreEqual(PaymentOutcome.Complete, a.Outcome); - } - } - - public class FonepayClientPlayModeTests - { - [SetUp] - public void Reset() => FonepayConfig.Invalidate(); - - [Test] - public void Ctor_WithoutConfigAsset_Throws() - { - // No FonepayConfig resource in test context → Load() throws FonepayError. - Assert.Throws(() => new FonepayClient()); - } - - [UnityTest] - public IEnumerator AwaitPaymentAsync_EmptyUrl_Throws() => RunAsync(async () => - { - var client = TryBuildClient(); - if (client == null) Assert.Pass("Skipped: no FonepayConfig in test context."); - - Assert.ThrowsAsync(async () => - await client.AwaitPaymentAsync(string.Empty)); - }); - - [UnityTest] - public IEnumerator AwaitPaymentAsync_PreCancelled_Throws() => RunAsync(async () => - { - var client = TryBuildClient(); - if (client == null) Assert.Pass("Skipped: no FonepayConfig in test context."); - - using var cts = new CancellationTokenSource(); - cts.Cancel(); - - Assert.ThrowsAsync(async () => - await client.AwaitPaymentAsync("ws://127.0.0.1:1/", ct: cts.Token)); - }); - - private static FonepayClient TryBuildClient() - { - try { return new FonepayClient(); } - catch (FonepayError) { return null; } - } - - private static IEnumerator RunAsync(Func body) - { - var t = body(); - while (!t.IsCompleted) yield return null; - if (t.IsFaulted) throw t.Exception; - } - } -}