public void ShouldThrowNoContainerExceptionWhenResolvingMultipleTypesBeforeInitializingTheContainer()
        {
            //Arrange
            var containerExtension = new WindsorExtension(registrationHelper, options);

            //Act
            var result = ExceptionAssert.Throws <NoContainerException>(() => containerExtension.ResolveAll <object>());

            //Assert
            Assert.AreEqual(NoContainerException.DefaultMessage, result.Message);
        }
        public void ShouldResolveMultipleTypes()
        {
            //Arrange
            var containerExtension = new WindsorExtension(registrationHelper, options);
            var container          = A.Fake <IWindsorContainer>();
            var instances          = new[] { new object(), new object() };

            A.CallTo(() => container.AddFacility <FactorySupportFacility>()).Returns(container);
            A.CallTo(() => container.ResolveAll <object>()).Returns(instances);
            containerExtension.InitializeContainer(container);

            //Act
            var result = containerExtension.ResolveAll <object>();

            //Assert
            A.CallTo(() => container.ResolveAll <object>()).MustHaveHappened();
            Assert.IsNotNull(result);
            Assert.AreSame(instances, result);
        }
        public void ShouldRegisterAllTypesOfIBootstrapperRegistration()
        {
            //Arrange
            var assembly = Assembly.GetAssembly(typeof(AutoMapperRegistration));

            A.CallTo(() => registrationHelper.GetAssemblies()).Returns(new List <Assembly> {
                assembly
            });
            var containerExtension = new WindsorExtension(registrationHelper, options);

            //Act
            containerExtension.Run();
            var result = containerExtension.ResolveAll <IBootstrapperRegistration>();

            //Assert
            A.CallTo(() => registrationHelper.GetAssemblies()).MustHaveHappened();
            Assert.IsInstanceOfType(result, typeof(IEnumerable <IBootstrapperRegistration>));
            Assert.IsTrue(result.Any());
            Assert.IsTrue(result[0] is AutoMapperRegistration);
        }