more tests
parent
07ae6b3590
commit
f3fa440583
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
|
||||
namespace Encompass
|
||||
{
|
||||
|
@ -25,8 +24,52 @@ namespace Encompass
|
|||
world.Update();
|
||||
|
||||
Assert.IsTrue(entity.HasComponent<MockComponent>());
|
||||
Assert.AreEqual(3, entity.GetComponent<MockComponent>().myInt);
|
||||
Assert.AreEqual("hello", entity.GetComponent<MockComponent>().myString);
|
||||
Assert.AreEqual(mockComponent, entity.GetComponent<MockComponent>());
|
||||
}
|
||||
|
||||
[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>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue