예제 #1
0
 public void BindingInterfaceToImplementation_ShouldUseSpecifiedImplementationClass()
 {
     container = new DefaultContainer(new BindingInterfaceAndImplementationConfiguration());
     var emptyInterfaceInstance = container.getInstance<EmptyInterface>();
     Assert.That(emptyInterfaceInstance, Is.Not.Null);
     Assert.That(emptyInterfaceInstance, Is.InstanceOf<DerievedFromEmptyInterface>());
 }
예제 #2
0
 public void BindingInterfaceToExistingInstance_ShouldUseSpecifiedObject()
 {
     container = new DefaultContainer(new BindingInterfaceAndExistingInstanceConfiguration());
     var emptyInterfaceInstance = container.getInstance<EmptyInterface>();
     Assert.That(emptyInterfaceInstance, Is.Not.Null);
     Assert.That(emptyInterfaceInstance, Is.SameAs(exampleInstance));
 }
예제 #3
0
 public void BindingQualifierToImplementation_ShouldUseSpecifiedImplementationClass()
 {
     container = new DefaultContainer(new BindingQualifierConfiguration());
     var qualifierUsage = container.getInstance<QualifierUsageExample>();
     Assert.That(qualifierUsage, Is.Not.Null);
     Assert.That(qualifierUsage.Property, Is.Not.Null);
     Assert.That(qualifierUsage.Property, Is.InstanceOf<OtherInterfaceImplementation>());
 }