Entity AddTag Method Delta Engine Documentation

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

public void AddTag(
	string tag
)
Remarks

Tests: DeltaEngine.Tests.Entities.EntityTests
Examples

2 unit tests call DeltaEngine.Entities.Entity.AddTag(System.String)
[Test]
public void ToStringWithTags()
{
    entityWithTags.ClearTags();
    Assert.AreEqual("MockEntity", entityWithTags.ToString());
    entityWithTags.AddTag("Empty");
    entityWithTags.AddTag("Empty");
    entityWithTags.AddTag("Entity");
    Assert.AreEqual("MockEntity Tags=Empty, Entity", entityWithTags.ToString());
    entityWithTags.RemoveTag("Entity");
    Assert.AreEqual("MockEntity Tags=Empty", entityWithTags.ToString());
    entityWithTags.ClearTags();
    Assert.AreEqual("MockEntity", entityWithTags.ToString());
}
[Test]
public void TagsAddedWhileInactiveTakeEffectAfterReactivation()
{
    entityWithTags.IsActive = false;
    entityWithTags.AddTag(Tag1);
    Assert.AreEqual(0, entities.GetEntitiesWithTag(Tag1).Count);
    entityWithTags.IsActive = true;
    Assert.AreEqual(1, entities.GetEntitiesWithTag(Tag1).Count);
}
See Also