more tests

pull/5/head
Evan Hemsley 2019-06-13 20:41:21 -07:00
parent 07ae6b3590
commit f3fa440583
1 changed files with 47 additions and 4 deletions

View File

@ -1,6 +1,5 @@
using System;
using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using System.Linq;
namespace Encompass namespace Encompass
{ {
@ -25,8 +24,52 @@ namespace Encompass
world.Update(); world.Update();
Assert.IsTrue(entity.HasComponent<MockComponent>()); Assert.IsTrue(entity.HasComponent<MockComponent>());
Assert.AreEqual(3, entity.GetComponent<MockComponent>().myInt); Assert.AreEqual(mockComponent, entity.GetComponent<MockComponent>());
Assert.AreEqual("hello", entity.GetComponent<MockComponent>().myString); }
[Test]
public void GetComponents()
{
var world = new World();
var entity = world.CreateEntity();
var mockComponentA = entity.AddComponent<MockComponent>();
var mockComponentB = entity.AddComponent<MockComponent>();
var mockComponentC = entity.AddComponent<MockComponent>();
world.Update();
Assert.Contains(mockComponentA, entity.GetComponents<MockComponent>().ToList());
Assert.Contains(mockComponentB, entity.GetComponents<MockComponent>().ToList());
Assert.Contains(mockComponentC, entity.GetComponents<MockComponent>().ToList());
}
[Test]
public void GetComponent()
{
var world = new World();
var entity = world.CreateEntity();
var mockComponent = entity.AddComponent<MockComponent>();
mockComponent.myString = "hello";
mockComponent.myInt = 3;
world.Update();
Assert.AreEqual(mockComponent, entity.GetComponent<MockComponent>());
}
[Test]
public void HasComponent()
{
var world = new World();
var entity = world.CreateEntity();
var mockComponent = entity.AddComponent<MockComponent>();
world.Update();
Assert.IsTrue(entity.HasComponent<MockComponent>());
} }
} }
} }