mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 21:25:52 +12:00
Begin work on Unit Tests
This commit is contained in:
parent
cf7605c6c9
commit
eaf1db1ee1
51 changed files with 3883 additions and 2101 deletions
40
HorseIsleServer/HISPtests/UnitTests/ServerStartTest.cs
Normal file
40
HorseIsleServer/HISPtests/UnitTests/ServerStartTest.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using HISP.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Tests.UnitTests
|
||||
{
|
||||
public class ServerStartTest
|
||||
{
|
||||
|
||||
public static void OnShutdown()
|
||||
{
|
||||
ResultLogger.LogTestStatus(false, "START_SERVER", "OnShutdown called");
|
||||
}
|
||||
public static void LogStdout(bool error, string type, string text)
|
||||
{
|
||||
if (type == "CRASH")
|
||||
ResultLogger.LogTestStatus(false, "START_SERVER", text);
|
||||
}
|
||||
|
||||
public static bool RunServerStartTest()
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.SetCallback(LogStdout);
|
||||
Entry.SetShutdownCallback(OnShutdown);
|
||||
Entry.Start();
|
||||
ResultLogger.LogTestStatus(true, "START_SERVER_TEST", "Success.");
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ResultLogger.LogTestStatus(false, "START_SERVER_TEST", e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue