mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-26 00:45:20 +00:00
* 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
54 lines
1.7 KiB
C#
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>());
|
|
}
|
|
}
|
|
} |