using NUnit.Framework; using System.Linq; using Encompass; using System.Collections.Generic; namespace Tests { public class EngineTest { static IEnumerable components; public class TestEngine : Engine { public override void Update(float dt) { components = this.ReadComponents(); } } [Test] public void ReadComponents() { var worldBuilder = new WorldBuilder(); worldBuilder.AddEngine(); var entity = worldBuilder.CreateEntity(); MockComponent mockComponent; mockComponent.myInt = 0; mockComponent.myString = "hello"; MockComponent mockComponentB; mockComponentB.myInt = 1; mockComponentB.myString = "howdy"; entity.AddComponent(mockComponent); entity.AddComponent(mockComponentB); var world = worldBuilder.Build(); world.Update(0.01f); Assert.Contains(mockComponent, components.ToList()); Assert.Contains(mockComponentB, components.ToList()); } } }