github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/utils/unittest/mockEntity.go (about) 1 package unittest 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 ) 6 7 // MockEntity implements a bare minimum entity for sake of test. 8 type MockEntity struct { 9 Identifier flow.Identifier 10 Nonce uint64 11 } 12 13 func (m MockEntity) ID() flow.Identifier { 14 return m.Identifier 15 } 16 17 func (m MockEntity) Checksum() flow.Identifier { 18 return m.Identifier 19 } 20 21 func EntityListFixture(n uint) []*MockEntity { 22 list := make([]*MockEntity, 0, n) 23 24 for i := uint(0); i < n; i++ { 25 list = append(list, &MockEntity{ 26 Identifier: IdentifierFixture(), 27 }) 28 } 29 30 return list 31 } 32 33 func MockEntityFixture() *MockEntity { 34 return &MockEntity{Identifier: IdentifierFixture()} 35 } 36 37 func MockEntityListFixture(count int) []*MockEntity { 38 entities := make([]*MockEntity, 0, count) 39 for i := 0; i < count; i++ { 40 entities = append(entities, MockEntityFixture()) 41 } 42 return entities 43 }