mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
cleanup tests
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27e753c1d16c45dd850480d93337a20b
|
||||
timeCreated: 1642791855
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user