public void RegisterSingleInstance_TypeProvided_SingleInstanceRegistered() { SimpleInjector simpleInjector = new SimpleInjector(); simpleInjector.RegisterSingleInstance <TestClass>(); Assert.AreEqual(simpleInjector.Resolve <TestClass>(), simpleInjector.Resolve <TestClass>()); }
public void Constructor_InjectorWithControlledLifetimeTypesProvided_ControlledLifetimeTypesCopied() { SimpleInjector simpleInjector = new SimpleInjector(); simpleInjector.RegisterSingleInstance <TestClass>(); SimpleInjector simpleInjectorCopy = new SimpleInjector(simpleInjector); Assert.AreEqual(simpleInjectorCopy.Resolve <TestClass>(), simpleInjectorCopy.Resolve <TestClass>()); }
public void Register_ImplementationTypeProvided_InterfaceResolved() { SimpleInjector simpleInjector = new SimpleInjector(); simpleInjector.Register <ITestClass, TestClass>(); Assert.IsNotNull(simpleInjector.Resolve <ITestClass>()); }
public void Resolve_ConstructorHasValueDependency_DependencyResolved() { SimpleInjector simpleInjector = new SimpleInjector(); TestClassValueParameter result = simpleInjector.Resolve <TestClassValueParameter>(); Assert.IsNotNull(result); }
public void RegisterSingleInstance_InstanceProvided_SingleInstanceRegistered() { TestClass singleton = new TestClass(16); SimpleInjector simpleInjector = new SimpleInjector(); simpleInjector.RegisterSingleInstance(singleton); Assert.AreEqual(singleton, simpleInjector.Resolve <TestClass>()); }
public void Constructor_InjectorWithImplementationMapProvided_ImplementationMapCopied() { SimpleInjector simpleInjector = new SimpleInjector(); simpleInjector.Register <ITestClass, TestClass>(); SimpleInjector simpleInjectorCopy = new SimpleInjector(simpleInjector); Assert.IsNotNull(simpleInjectorCopy.Resolve <ITestClass>()); }
public void Resolve_ClassHasRegisteredSetterDependency_DependencyResolved() { SimpleInjector simpleInjector = new SimpleInjector(); simpleInjector.Register <ITestClass, TestClass>(); TestClassSetter result = simpleInjector.Resolve <TestClassSetter>(); Assert.IsNotNull(result); }
public void Constructor_InjectorWithInstanceMapProvided_InstanceMapCopied() { TestClass singleton = new TestClass(16); SimpleInjector simpleInjector = new SimpleInjector(); simpleInjector.RegisterSingleInstance(singleton); SimpleInjector simpleInjectorCopy = new SimpleInjector(simpleInjector); Assert.AreEqual(singleton, simpleInjectorCopy.Resolve <TestClass>()); }
public void Resolve_SimpleInjectorTypeProvided_ExistingInstanceReturned() { SimpleInjector simpleInjector = new SimpleInjector(); Assert.AreEqual(simpleInjector, simpleInjector.Resolve <SimpleInjector>()); }
public void Register_ImplementationTypeNotProvided_ThrowsArgumentException() { SimpleInjector simpleInjector = new SimpleInjector(); simpleInjector.Resolve <ITestClass>(); }
public void Resolve_NoPublicConstructor_ThrowsEntryPointNotFoundException() { SimpleInjector simpleInjector = new SimpleInjector(); TestClassNoPublicConstructor result = simpleInjector.Resolve <TestClassNoPublicConstructor>(); }
public void Resolve_DependencyPropertyHasNoSetter_ThrowsMissingMethodException() { SimpleInjector simpleInjector = new SimpleInjector(); TestClassNoSetter result = simpleInjector.Resolve <TestClassNoSetter>(); }
public void Resolve_PrimitiveTypeProvided_DefaultValueReturned() { SimpleInjector simpleInjector = new SimpleInjector(); Assert.AreEqual(default(int), simpleInjector.Resolve <int>()); }
/// <summary> /// Creates a new instance of the <see cref="App"/> class. /// </summary> public App() : base() { _simpleInjector.RegisterSingleInstance <BinarySerializerOptions>(); _simpleInjector.RegisterSingleInstance <BinarySerializer>(); _simpleInjector.Resolve <MainWindow>().Show(); }