update: 添加测试用例

deeplink
胡宇飞 2024-04-09 08:28:19 +08:00
parent 78f9e3b330
commit ef3a11c382
7 changed files with 89 additions and 0 deletions

3
Tests.meta Normal file
View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 75760985db114e44bfcd901ed50af96c
timeCreated: 1712580213

View File

@ -0,0 +1,22 @@
{
"name": "GuruSDK.Tests",
"rootNamespace": "Guru.Tests",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"Guru.Runtime"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9eaf5abb3054d452ba2776169a31aa91
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

3
Tests/IAP.meta Normal file
View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c3f29532318446f2aa35c275859dad0d
timeCreated: 1712580248

43
Tests/IAP/Test_IAP.cs Normal file
View File

@ -0,0 +1,43 @@
using UnityEngine;
namespace Guru.Tests
{
using Guru;
using UnityEditor;
using NUnit.Framework;
public class Test_IAP
{
[Test]
public void Test__AppleOrders()
{
var model = IAPModel.Load();
int level = 1;
for (int i = 0; i < 5; i++)
{
model.AddAppleOrder(new AppleOrderData(0, $"i.iap.test.icon_{i}", "receipt_{i}", level));
level++;
}
if (model.HasUnreportedAppleOrder)
{
int i = 0;
while (model.appleOrders.Count > 0
&& i < model.appleOrders.Count)
{
var o = model.appleOrders[i];
model.RemoveAppleOrder(o);
i++;
}
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7181a5508c604c439d3f4585ff49a5e0
timeCreated: 1712580254

8
Tests/IAP/Tests.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 80c78f22e10d0411d85fb2a24c69cab2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: