Files
MonoGame.Extended/Source/Tests/MonoGame.Extended.Entities.Tests/EntityTemplateTests.cs
T
Jon SeamanandDylan Wilson eb5fd93e9f Feature label styling (#454)
* Added some basic tests for the ECS

* Add test project for Nuclex Gui

* Nuclex Gui project update

* Added ability to style labels

* Removed Nuclex Gui Test project for lack of tests
2018-01-10 13:36:20 +10:00

54 lines
1.7 KiB
C#

using System;
using Microsoft.Xna.Framework;
using MonoGame.Extended.Entities;
using MonoGame.Extended.Gui.Tests.Implementation;
using NUnit.Framework;
namespace MonoGame.Extended.Gui.Tests
{
[TestFixture]
public class EntityTemplateTests
{
[Test]
public void ECS_CreateEntityFromTemplate_Basic_Test()
{
// Seems to work with null.
var ecs = new EntityComponentSystem(null);
ecs.Scan(typeof(EntityTemplateBasic).Assembly);
var manager = ecs.EntityManager;
Entity entity = null;
try
{
entity = manager.CreateEntityFromTemplate(EntityTemplateBasic.Name);
}
catch (Exception e)
{
Assert.Fail("Failed to create entity from template.\n" + e.StackTrace);
}
Assert.NotNull(entity);
Assert.NotNull(entity.Get<EntityComponentBasic>());
}
[Test]
public void ECS_CreateEntityFromTemplate_UsingManager_Test()
{
// Seems to work with null.
var ecs = new EntityComponentSystem(null);
ecs.Scan(typeof(EntityTemplateUsingManager).Assembly);
var manager = ecs.EntityManager;
Entity entity = null;
try
{
entity = manager.CreateEntityFromTemplate(EntityTemplateUsingManager.Name);
}
catch (Exception e)
{
Assert.Fail("Failed to create entity from template.\n" + e.StackTrace);
}
Assert.NotNull(entity);
Assert.NotNull(entity.Get<EntityComponentBasic>());
}
}
}