DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Classes | Public Member Functions | List of all members
Deveel.Data.Services.ServiceContainerTests Class Reference

Classes

interface  ITestService
 
class  TestService1
 
class  TestService2
 

Public Member Functions

void RegisterAndResolveFromChild ()
 
void RegisterInstanceAndResolveFromChild ()
 
void RegisterInstanceAndResolveAllFromChild ()
 
void ResolveFromChildWithParentService ()
 

Detailed Description

Definition at line 22 of file ServiceContainerTests.cs.

Member Function Documentation

void Deveel.Data.Services.ServiceContainerTests.RegisterAndResolveFromChild ( )
inline

Definition at line 24 of file ServiceContainerTests.cs.

24  {
25  var parent = new ServiceContainer();
26  parent.Register<TestService1>();
27 
28  var child = parent.OpenScope("child");
29 
30  var childService = child.Resolve<ITestService>();
31  var parentService = parent.Resolve<ITestService>();
32 
33  Assert.IsNotNull(childService);
34  Assert.IsInstanceOf<TestService1>(childService);
35 
36  Assert.IsNotNull(parentService);
37  Assert.IsInstanceOf<TestService1>(parentService);
38 
39  Assert.AreEqual(parentService, childService);
40  }
void Deveel.Data.Services.ServiceContainerTests.RegisterInstanceAndResolveAllFromChild ( )
inline

Definition at line 59 of file ServiceContainerTests.cs.

59  {
60  var instance = new TestService1();
61 
62  var parent = new ServiceContainer();
63  parent.RegisterInstance(instance);
64 
65  var child = parent.OpenScope("child");
66 
67  var services = child.ResolveAll<ITestService>();
68 
69  Assert.IsNotEmpty(services);
70  Assert.AreEqual(1, services.Count());
71  }
void Deveel.Data.Services.ServiceContainerTests.RegisterInstanceAndResolveFromChild ( )
inline

Definition at line 43 of file ServiceContainerTests.cs.

43  {
44  var instance = new TestService1();
45 
46  var parent = new ServiceContainer();
47  parent.RegisterInstance(instance);
48 
49  var child = parent.OpenScope("child");
50 
51  var childService = child.Resolve<ITestService>();
52 
53  Assert.IsNotNull(childService);
54  Assert.IsInstanceOf<TestService1>(childService);
55  Assert.AreEqual(instance, childService);
56  }
void Deveel.Data.Services.ServiceContainerTests.ResolveFromChildWithParentService ( )
inline

Definition at line 74 of file ServiceContainerTests.cs.

74  {
75  var parent = new ServiceContainer();
76  parent.Register<TestService1>();
77 
78  var child = parent.OpenScope("child");
79  child.Register<TestService2>();
80 
81  var service2 = child.Resolve<TestService2>();
82 
83  Assert.IsNotNull(service2);
84  Assert.IsNotNull(service2.Service1);
85  }

The documentation for this class was generated from the following file: