38 lines
1008 B
C#
38 lines
1008 B
C#
using System;
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
|
|
namespace Encompass
|
|
{
|
|
namespace Tests {
|
|
class MockComponent : Component {
|
|
public string myString;
|
|
public int myInt;
|
|
}
|
|
|
|
public class EntityTest
|
|
{
|
|
/*
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
}
|
|
*/
|
|
|
|
[Test]
|
|
public void AddComponent()
|
|
{
|
|
var entity = new Entity(0);
|
|
var mockComponent = entity.AddComponent<MockComponent>();
|
|
mockComponent.myString = "hello";
|
|
mockComponent.myInt = 3;
|
|
|
|
Assert.IsTrue(entity.HasComponent<MockComponent>());
|
|
Assert.AreEqual(3, entity.GetComponent<MockComponent>().myInt);
|
|
Assert.AreEqual("hello", entity.GetComponent<MockComponent>().myString);
|
|
Assert.AreEqual(0, entity.GetComponent<MockComponent>().EntityID);
|
|
}
|
|
}
|
|
}
|
|
}
|