Entity2DTests SetAndGetEntity2DComponentsDirectly Method Delta Engine Documentation

Namespace: DeltaEngine.Rendering2D.Tests
Assembly: DeltaEngine.Rendering2D.Tests (in DeltaEngine.Rendering2D.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void SetAndGetEntity2DComponentsDirectly()
Examples

[Test]
public void SetAndGetEntity2DComponentsDirectly()
{
    var entity = new Entity2D(DoubleSizedRectangle) { Color = Color.Red };
    entity.Set(Color.Green);
    Assert.AreEqual(Color.Green, entity.Get<Color>());
    entity.Set(Rectangle.One);
    Assert.AreEqual(Rectangle.One, entity.Get<Rectangle>());
    entity.Set(5.0f);
    Assert.AreEqual(5.0f, entity.Get<float>());
    entity.Set(Vector2D.One);
    Assert.AreEqual(Vector2D.One, entity.Get<Vector2D>());
    entity.RenderLayer = -10;
    Assert.AreEqual(-10, entity.RenderLayer);
}
See Also