Added NightAlert project for travel kit
This commit is contained in:
82
ThirdParty/SocketIoClientDotNet/Src/SocketIoClientDotNet.Tests.net45/ClientTests/Connection.cs
vendored
Normal file
82
ThirdParty/SocketIoClientDotNet/Src/SocketIoClientDotNet.Tests.net45/ClientTests/Connection.cs
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
using Newtonsoft.Json;
|
||||
using Quobject.EngineIoClientDotNet.Modules;
|
||||
using Quobject.SocketIoClientDotNet.Client;
|
||||
using System.IO;
|
||||
|
||||
namespace SocketIoClientDotNet.Tests.ClientTests
|
||||
{
|
||||
public class Connection
|
||||
{
|
||||
public static readonly int TIMEOUT = 300000;
|
||||
|
||||
static Connection()
|
||||
{
|
||||
LogManager.SetupLogManager();
|
||||
}
|
||||
|
||||
protected IO.Options CreateOptions()
|
||||
{
|
||||
var log = LogManager.GetLogger(Global.CallerName());
|
||||
|
||||
|
||||
var config = ConfigBase.Load();
|
||||
var options = new IO.Options();
|
||||
options.Port = config.server.port;
|
||||
options.Hostname = config.server.hostname;
|
||||
options.ForceNew = true;
|
||||
log.Info("Please add to your hosts file: 127.0.0.1 " + options.Hostname);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
protected string CreateUri()
|
||||
{
|
||||
var options = CreateOptions();
|
||||
var uri = string.Format("{0}://{1}:{2}", options.Secure ? "https" : "http", options.Hostname, options.Port);
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
protected IO.Options CreateOptionsSecure()
|
||||
{
|
||||
var log = LogManager.GetLogger(Global.CallerName());
|
||||
|
||||
var config = ConfigBase.Load();
|
||||
var options = new IO.Options();
|
||||
options.Port = config.server.ssl_port;
|
||||
options.Hostname = config.server.hostname;
|
||||
log.Info("Please add to your hosts file: 127.0.0.1 " + options.Hostname);
|
||||
options.Secure = true;
|
||||
options.IgnoreServerCertificateValidation = true;
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfigBase
|
||||
{
|
||||
public string version { get; set; }
|
||||
public ConfigServer server { get; set; }
|
||||
|
||||
public static ConfigBase Load()
|
||||
{
|
||||
var result = new ConfigBase()
|
||||
{
|
||||
server = new ConfigServer()
|
||||
};
|
||||
result.server.hostname = ConnectionConstants.HOSTNAME;
|
||||
result.server.port = ConnectionConstants.PORT;
|
||||
result.server.ssl_port = ConnectionConstants.SSL_PORT;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfigServer
|
||||
{
|
||||
public string hostname { get; set; }
|
||||
public int port { get; set; }
|
||||
public int ssl_port { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SocketIoClientDotNet.Tests.ClientTests
|
||||
{
|
||||
public static class ConnectionConstants
|
||||
{
|
||||
public static int PORT = 80;
|
||||
public static string HOSTNAME = "testme.quobject.com";
|
||||
public static int SSL_PORT = 443;
|
||||
public static readonly int TIMEOUT = 300000;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using Newtonsoft.Json;
|
||||
using Quobject.EngineIoClientDotNet.Modules;
|
||||
using Quobject.SocketIoClientDotNet.Client;
|
||||
using System.IO;
|
||||
|
||||
namespace SocketIoClientDotNet.Tests.ClientTests
|
||||
{
|
||||
public class Connection
|
||||
{
|
||||
public static readonly int TIMEOUT = 300000;
|
||||
|
||||
static Connection()
|
||||
{
|
||||
LogManager.SetupLogManager();
|
||||
}
|
||||
|
||||
protected IO.Options CreateOptions()
|
||||
{
|
||||
//var log = LogManager.GetLogger(Global.CallerName());
|
||||
|
||||
|
||||
var config = ConfigBase.Load();
|
||||
var options = new IO.Options();
|
||||
options.Port = config.server.port;
|
||||
options.Hostname = config.server.hostname;
|
||||
options.ForceNew = true;
|
||||
//log.Info("Please add to your hosts file: 127.0.0.1 " + options.Hostname);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
protected string CreateUri()
|
||||
{
|
||||
var options = CreateOptions();
|
||||
var uri = string.Format("{0}://{1}:{2}", options.Secure ? "https" : "http", options.Hostname, options.Port);
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
protected IO.Options CreateOptionsSecure()
|
||||
{
|
||||
//var log = LogManager.GetLogger(Global.CallerName());
|
||||
|
||||
var config = ConfigBase.Load();
|
||||
var options = new IO.Options();
|
||||
options.Port = config.server.ssl_port;
|
||||
options.Hostname = config.server.hostname;
|
||||
//log.Info("Please add to your hosts file: 127.0.0.1 " + options.Hostname);
|
||||
options.Secure = true;
|
||||
options.IgnoreServerCertificateValidation = true;
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfigBase
|
||||
{
|
||||
public string version { get; set; }
|
||||
public ConfigServer server { get; set; }
|
||||
|
||||
public static ConfigBase Load()
|
||||
{
|
||||
//var configString = File.ReadAllText("./../../../../grunt/config.json");
|
||||
var configString = @"{""version"":""0.1.0.0"",""server"":{""port"":80,""ssl_port"":443,""hostname"":""192.168.178.59""},""win"":{""powershell"":""C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe"",""msbuild"":""C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe"",""xunit_path"":""C:/vendors/xunit"",""nuget"":""C:/vendors/nuget/nuget.exe""},""linux"":{""msbuild"":""xbuild"",""xunit_path"":""/home/apollo/vendors/xunit""}}";
|
||||
|
||||
var config = JsonConvert.DeserializeObject<ConfigBase>(configString);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfigServer
|
||||
{
|
||||
public string hostname { get; set; }
|
||||
public int port { get; set; }
|
||||
public int ssl_port { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1327
ThirdParty/SocketIoClientDotNet/Src/SocketIoClientDotNet.Tests.net45/ClientTests/ServerConnectionTest.cs
vendored
Normal file
1327
ThirdParty/SocketIoClientDotNet/Src/SocketIoClientDotNet.Tests.net45/ClientTests/ServerConnectionTest.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
49
ThirdParty/SocketIoClientDotNet/Src/SocketIoClientDotNet.Tests.net45/ClientTests/UrlTest.cs
vendored
Normal file
49
ThirdParty/SocketIoClientDotNet/Src/SocketIoClientDotNet.Tests.net45/ClientTests/UrlTest.cs
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
using Quobject.SocketIoClientDotNet.Client;
|
||||
using Xunit;
|
||||
|
||||
namespace SocketIoClientDotNet.Tests.ClientTests
|
||||
{
|
||||
public class UrlTest
|
||||
{
|
||||
[Fact]
|
||||
public void Parse()
|
||||
{
|
||||
const string test = @"http://username:password@host:8080/directory/file?query#ref";
|
||||
var result = Url.Parse(test);
|
||||
var str = result.ToString();
|
||||
Assert.Equal(test,str);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseRelativePath()
|
||||
{
|
||||
const string test = @"https://woot.com/test";
|
||||
var result = Url.Parse(test);
|
||||
Assert.Equal("https",result.Scheme);
|
||||
Assert.Equal("woot.com",result.Host);
|
||||
Assert.Equal("/test",result.LocalPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseNoProtocol()
|
||||
{
|
||||
const string test = @"//localhost:3000";
|
||||
var result = Url.Parse(test);
|
||||
Assert.Equal("http", result.Scheme);
|
||||
Assert.Equal("localhost", result.Host);
|
||||
Assert.Equal(3000, result.Port);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseNamespace()
|
||||
{
|
||||
var result = Url.Parse(@"http://woot.com/woot");
|
||||
Assert.Equal("/woot", result.LocalPath);
|
||||
result = Url.Parse(@"http://google.com");
|
||||
Assert.Equal("/", result.LocalPath);
|
||||
result = Url.Parse(@"http://google.com/");
|
||||
Assert.Equal("/", result.LocalPath);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user