public void should_correctly_return_entities_containing_tags() { var tag1 = 1; var tag2 = 2; var tag3 = 3; var tag4 = 4; var entity123 = new TaggedEntity(tag1, tag2, tag3); var entity23 = new TaggedEntity(tag2, tag3); var entity13 = new TaggedEntity(tag1, tag3); var entity34 = new TaggedEntity(tag3, tag4); var entity1234 = new TaggedEntity(tag1, tag2, tag3, tag4); var allEntities = new[] { entity13, entity23, entity34, entity123, entity1234 }; var entitiesMatching1and3 = allEntities.ContainingTags(tag1, tag3).ToArray(); var entitiesMatching1and2and3 = allEntities.ContainingTags(tag1, tag2, tag3).ToArray(); Assert.Equal(3, entitiesMatching1and3.Length); Assert.True(entitiesMatching1and3.Contains(entity13)); Assert.True(entitiesMatching1and3.Contains(entity123)); Assert.True(entitiesMatching1and3.Contains(entity1234)); Assert.Equal(2, entitiesMatching1and2and3.Length); Assert.True(entitiesMatching1and2and3.Contains(entity123)); Assert.True(entitiesMatching1and2and3.Contains(entity1234)); }
private static EntityFullData CreateTwoPyramidEntity(EntityManagerService ems, float size1, float size2) { TaggedEntity ent = ems.CreateEntity(); TaggedObject obj = ems.CreateObject(); EntityFullData entityData = ent.GetTag <EntityFullData>(); entityData.TaggedObject = obj; ModelFullData modelData = new ModelFullData(); modelData.Positions = CreatePyramidPositions(); modelData.ObjectMatrix = Matrix.CreateScale(size1); modelData.CalculateBoundingBox(); modelData.CalculateBoundingSphere(); entityData.ObjectFullData.Models.Add(modelData); modelData = new ModelFullData(); modelData.Positions = CreatePyramidPositions(); modelData.ObjectMatrix = Matrix.CreateScale(size2); modelData.CalculateBoundingBox(); modelData.CalculateBoundingSphere(); entityData.ObjectFullData.Models.Add(modelData); return(entityData); }
public void should_correctly_verify_entity_doesnt_contains_tags() { var tag1 = 1; var tag2 = 2; var tag3 = 3; var tag4 = 4; var entity123 = new TaggedEntity(tag1, tag2, tag3); var entity34 = new TaggedEntity(tag3, tag4); Assert.True(entity123.DoesNotContainsTags(tag4)); Assert.False(entity123.DoesNotContainsTags(tag3, tag4)); Assert.True(entity34.DoesNotContainsTags(tag1, tag2)); }