(t *testing.T)
| 67 | } |
| 68 | |
| 69 | func TestEntityCollection(t *testing.T) { |
| 70 | // Create a new EntityCollection with two entities |
| 71 | entity1 := &base.Entity{Type: "book", Id: "b1"} |
| 72 | entity2 := &base.Entity{Type: "book", Id: "b2"} |
| 73 | entityColl := NewEntityCollection(entity1, entity2) |
| 74 | |
| 75 | // Test the CreateEntityIterator method |
| 76 | iter := entityColl.CreateEntityIterator() |
| 77 | assert.NotNil(t, iter) |
| 78 | |
| 79 | // Test the GetEntities method |
| 80 | entities := entityColl.GetEntities() |
| 81 | assert.Equal(t, 2, len(entities)) |
| 82 | assert.Equal(t, entity1, entities[0]) |
| 83 | assert.Equal(t, entity2, entities[1]) |
| 84 | |
| 85 | // Test the Add method |
| 86 | entity3 := &base.Entity{Type: "book", Id: "b3"} |
| 87 | entityColl.Add(entity3) |
| 88 | entities = entityColl.GetEntities() |
| 89 | assert.Equal(t, 3, len(entities)) |
| 90 | assert.Equal(t, entity3, entities[2]) |
| 91 | } |
| 92 | |
| 93 | func TestAttributeCollection(t *testing.T) { |
| 94 | // Create a new AttributeCollection with two attributes |
nothing calls this directly
no test coverage detected