public void ShouldThrowNoContainerExceptionWhenRegisteringWithTargetAndImplementationInstanceBeforeInitializingTheContainer() { //Arrange var containerExtension = new UnityExtension(registrationHelper, options); //Act var result = ExceptionAssert.Throws <NoContainerException>(() => containerExtension.Register <IBootstrapperContainerExtension>(containerExtension)); //Assert Assert.AreEqual(NoContainerException.DefaultMessage, result.Message); }
public void ShouldRegisterWithTargetAndImplementationType() { //Arrange var container = new UnityContainer(); var containerExtension = new UnityExtension(registrationHelper, options); containerExtension.InitializeContainer(container); //Act containerExtension.Register <IBootstrapperAssemblyProvider, LoadedAssemblyProvider>(); var result = container.Resolve <IBootstrapperAssemblyProvider>(typeof(LoadedAssemblyProvider).Name); //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(LoadedAssemblyProvider)); }