MCPcopy Create free account
hub / github.com/golobby/container / TestContainer_Call_With_Multiple_Resolving

Function TestContainer_Call_With_Multiple_Resolving

container_test.go:326–347  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

324}
325
326func TestContainer_Call_With_Multiple_Resolving(t *testing.T) {
327 err := instance.Singleton(func() Shape {
328 return &Circle{a: 5}
329 })
330 assert.NoError(t, err)
331
332 err = instance.Singleton(func() Database {
333 return &MySQL{}
334 })
335 assert.NoError(t, err)
336
337 err = instance.Call(func(s Shape, m Database) {
338 if _, ok := s.(*Circle); !ok {
339 t.Error("Expected Circle")
340 }
341
342 if _, ok := m.(*MySQL); !ok {
343 t.Error("Expected MySQL")
344 }
345 })
346 assert.NoError(t, err)
347}
348
349func TestContainer_Call_With_Dependency_Missing_In_Chain(t *testing.T) {
350 var instance = container.New()

Callers

nothing calls this directly

Calls 2

SingletonMethod · 0.80
CallMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…