package domain import ( "testing" "time" ) func TestMockFileRepo(t *testing.T) { r := new(MockFileRepository) r.NextId = 0 r.IdIdx = make(map[int64]*UserAgent) r.NameIdx = make(map[string]*UserAgent) all, err := r.All() if len(all) != 0 && err != nil { t.Errorf("New repo should be empty") } ua := UserAgent {23, "", time.Now(), time.Duration(time.Hour * 3), FileSizeQuota {1000, 0} } r.Create(ua) all, err = r.All() if len(all) != 1 && err != nil { t.Errorf("After adding there should be a Useragent") } if ua.ID != 23 { t.Errorf("It does not change the original UserAgent") } }