예제 #1
0
파일: main.go 프로젝트: willfaught/services
func configure(name string) offers.Configuration {
	return offers.Configuration{Name: name, OfferRepository: offer.NewRepository(mockgossie.NewMockConnectionPool())}
}
예제 #2
0
func TestRemote(t *testing.T) {
	// Service
	var service = offers.Offers{Configuration: offers.Configuration{OfferRepository: offer.NewRepository(mockgossie.NewMockConnectionPool())}}

	// Server
	var server = offers.MustNewServer(offers.Configuration{}, service, ":5000")
	go func() {
		if err := server.Start(); err != nil {
			panic(err)
		}
	}()

	// Client
	var client = offers.MustNewClient(offers.Configuration{}, ":5000")

	suite.Run(t, &offers.Suite{Interface: func() offers.Interface {
		return client
	}})

	// Client
	if err := client.Close(); err != nil {
		panic(err)
	}

	// Server
	if err := server.Stop(); err != nil {
		panic(err)
	}
}
예제 #3
0
func Test(t *testing.T) {
	suite.Run(t, &Suite{Interface: func() Interface {
		return Service{Configuration: Configuration{OfferRepository: offer.NewRepository(mockgossie.NewMockConnectionPool())}}
	}})
}
예제 #4
0
func TestLocal(t *testing.T) {
	suite.Run(t, &offers.Suite{Interface: func() offers.Interface {
		return offers.Offers{Configuration: offers.Configuration{OfferRepository: offer.NewRepository(mockgossie.NewMockConnectionPool())}}
	}})
}