owl-blogs/test/mock_entry.go

42 lines
727 B
Go
Raw Normal View History

2023-06-25 18:04:06 +00:00
package test
import (
"owl-blogs/domain/model"
"time"
)
type MockEntryMetaData struct {
Str string
Number int
Date time.Time
}
type MockEntry struct {
id string
publishedAt *time.Time
metaData *MockEntryMetaData
}
func (e *MockEntry) ID() string {
return e.id
}
func (e *MockEntry) Content() model.EntryContent {
2023-07-06 16:56:43 +00:00
return model.EntryContent(e.metaData.Str)
2023-06-25 18:04:06 +00:00
}
func (e *MockEntry) PublishedAt() *time.Time {
return e.publishedAt
}
func (e *MockEntry) MetaData() interface{} {
return e.metaData
}
2023-07-06 16:56:43 +00:00
func (e *MockEntry) Create(id string, publishedAt *time.Time, metaData model.EntryMetaData) error {
2023-06-25 18:04:06 +00:00
e.id = id
e.publishedAt = publishedAt
e.metaData = metaData.(*MockEntryMetaData)
return nil
}