Develop #10

Merged
SemvdH merged 229 commits from develop into master 2020-10-29 22:50:49 +00:00
3 changed files with 55 additions and 15 deletions
Showing only changes of commit a333d6cd8d - Show all commits

47
UnitTestRH/CommandTest.cs Normal file
View File

@@ -0,0 +1,47 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ProftaakRH;
using RH_Engine;
using System;
using System.Linq;
namespace UnitTestRH
{
[TestClass]
public class CommandTest
{
[TestMethod]
public void TerrainAdd_TestMethod()
{
string testTunnelID = "dummyTunnelID";
string testSerial = "dummySerialCode";
string payloadId = "tunnel/send";
string terrainId = "scene/terrain/add";
Command command = new Command(testTunnelID);
int[] terrainSizeArray = new int[2] { 4, 4 };
float[] terrainHeightsArray = new float[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
string terrainAddCommand = command.TerrainAdd(terrainSizeArray, terrainHeightsArray, testSerial);
dynamic json = JsonConvert.DeserializeObject(terrainAddCommand);
//Test payload
Assert.AreEqual(payloadId, (string)json.id);
Assert.AreEqual(testTunnelID, (string)json.data.dest);
//Test terrain
Assert.AreEqual(terrainId, (string)json.data.data.id);
Assert.AreEqual(testSerial, (string)json.data.data.serial);
//Test terrain settings
JArray jArrayTerrainSize = (JArray)json.data.data.data.size;
Assert.AreEqual(terrainSizeArray, jArrayTerrainSize.ToObject<float[]>());
//Assert.AreEqual(terrainHeightsArray, (float[])json.data.data.data.heights);
}
}
}

View File

@@ -1,15 +0,0 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RH_Engine;
namespace UnitTestRH
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Command command = new Command("");
}
}
}

View File

@@ -13,4 +13,12 @@
<PackageReference Include="coverlet.collector" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ClientApp\ClientApp.csproj" />
<ProjectReference Include="..\DoctorApp\DoctorApp.csproj" />
<ProjectReference Include="..\ProftaakRH\ProftaakRH.csproj" />
<ProjectReference Include="..\RH-Engine\RH-Engine.csproj" />
<ProjectReference Include="..\Server\Server.csproj" />
</ItemGroup>
</Project>