cleanup tests

This commit is contained in:
alexiscatnip
2022-01-22 03:06:23 +08:00
parent af5d5aef4f
commit 7c9d01722c
4 changed files with 56 additions and 36 deletions
+1 -36
View File
@@ -65,42 +65,7 @@ namespace Raindrop.Tests
Assert.IsTrue(instance.Client.Network.Connected, "Client is not connected to the grid");
}
//able to reach google.com, synchronous
[UnityTest]
public IEnumerator NetSync_Get_Google()
{
// Create the GET request.
var destinationUrl = new Uri("http://www.google.com");
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(destinationUrl);
request.Method = "GET";
// Content type is JSON.
request.ContentType = "application/json";
// Fill body.
// byte[] contentBytes = new UTF8Encoding().GetBytes(data);
// request.ContentLength = contentBytes.LongLength;
// request.GetRequestStream().Write(contentBytes, 0, contentBytes.Length);
try
{
using(HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Debug.Log("Publish Response: " + (int)response.StatusCode + ", " + response.StatusDescription);
if((int)response.StatusCode == 200)
{
Debug.Log("passed.");
}
}
}
catch(Exception e)
{
Debug.LogError(e.ToString());
}
Assert.Pass();
yield break;
}
// DownloadManager variant of 'wtf' WebRequest.
// (Used to) Fail in unity editor, android target, net standard 2.0
// (Used to) unity completely hang at call to HttpWebRequest.BeginGetResponse()
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 27e753c1d16c45dd850480d93337a20b
timeCreated: 1642791855
+49
View File
@@ -0,0 +1,49 @@
using System;
using System.Collections;
using System.Net;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
namespace Raindrop.Tests.NetTests
{
public class NetworkTests
{
//able to reach google.com, synchronous
[UnityTest]
public IEnumerator NetSync_Get_Google()
{
// Create the GET request.
var destinationUrl = new Uri("http://www.google.com");
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(destinationUrl);
request.Method = "GET";
// Content type is JSON.
request.ContentType = "application/json";
// Fill body.
// byte[] contentBytes = new UTF8Encoding().GetBytes(data);
// request.ContentLength = contentBytes.LongLength;
// request.GetRequestStream().Write(contentBytes, 0, contentBytes.Length);
try
{
using(HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Debug.Log("Publish Response: " + (int)response.StatusCode + ", " + response.StatusDescription);
if((int)response.StatusCode == 200)
{
Debug.Log("passed.");
}
}
}
catch(Exception e)
{
Debug.LogError(e.ToString());
}
Assert.Pass();
yield break;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b320bce51763443ab8d1d5b0160f2c1b
timeCreated: 1642791864