More test structure and first domain service test
parent
923f1b0ca6
commit
b0d4820659
@ -1,3 +0,0 @@
|
|||||||
package domain
|
|
||||||
|
|
||||||
//import "testing"
|
|
@ -0,0 +1,30 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"caj-larsson/bog/domain"
|
||||||
|
"caj-larsson/bog/test/mock"
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
var file_ref1 = domain.FileReference { "path1", "ua1" }
|
||||||
|
//var file_ref2 = domain.FileReference { "path1", "ua2" }
|
||||||
|
//var file_ref3 = domain.FileReference { "path2", "ua1" }
|
||||||
|
|
||||||
|
|
||||||
|
func TestFileService(t *testing.T) {
|
||||||
|
file_repo := mock.NewMockFileRepository()
|
||||||
|
ua_repo := mock.NewMockUserAgentRepository()
|
||||||
|
service := domain.NewBogFileService(ua_repo, file_repo)
|
||||||
|
|
||||||
|
outfile, err := service.OpenOutFile(file_ref1)
|
||||||
|
|
||||||
|
if outfile != nil && err != domain.ErrNotExists {
|
||||||
|
t.Errorf("File shall not exist by default")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue