internal void GetInstance_WithDependencies_DependenciesNotNull()
        {
            var result = NewContainer.GetInstance <IPerRequestDependencies>();

            Assert.NotNull(result.Foo);
            Assert.NotNull(result.Bar);
        }
        internal void GetInstance_EnumerableByThirdLevelInterface_ExpectedInstancesTypes()
        {
            var result = NewContainer.GetInstance <IReadOnlyCollection <IBar> >().ToList();

            Assert.Contains(typeof(Bar1), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Bar2), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Bar3), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Bar4), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Bar5), result.Select(x => x.GetType()));
        }
        internal void GetInstance_EnumerableBySecondLevelInterface_ExpectedInstancesTypes()
        {
            var result = NewContainer.GetInstance <IReadOnlyCollection <IFoo> >().ToList();

            Assert.Contains(typeof(Foo1), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Foo2), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Foo3), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Foo4), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Foo5), result.Select(x => x.GetType()));
        }
        internal void GetInstance_WithEnumerableDependency_ExpectedInstancesTypes()
        {
            var result = NewContainer.GetInstance <IReadOnlyCollectionDependencyFoo>().Services.ToList();

            Assert.Contains(typeof(Foo1), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Foo2), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Foo3), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Foo4), result.Select(x => x.GetType()));
            Assert.Contains(typeof(Foo5), result.Select(x => x.GetType()));
        }
Beispiel #5
0
        internal void GetInstance_ByInterfaceForGenericInterface_NotNull()
        {
            var result = NewContainer.GetInstance <IGenericService <IFooForGeneric> >();

            Assert.NotNull(result);
        }
Beispiel #6
0
        internal void GetInstance_CompositionRootSpecifiedByAttributesByAttribute_NotNull()
        {
            var result = NewContainer.GetInstance <FooForAttribute>();

            Assert.NotNull(result);
        }
        internal void GetInstance_EnumerableBySecondLevelInterface_NotEmpty()
        {
            var result = NewContainer.GetInstance <IReadOnlyCollection <IFoo> >();

            Assert.NotEmpty(result);
        }
Beispiel #8
0
        internal void GetInstance_ByFirstLevelInterface_ExpectedType()
        {
            var result = NewContainer.GetInstance <IService11>();

            Assert.IsType <Service11>(result);;
        }
        internal void GetInstance_EnumerableBySecondLevelInterface_NotNull()
        {
            var result = NewContainer.GetInstance <IEnumerable <IFoo> >();

            Assert.NotNull(result);
        }
Beispiel #10
0
        internal void GetInstance_NotNull()
        {
            var result = NewContainer.GetInstance <IMixedLifetimesPerContainerDependencies>();

            Assert.NotNull(result);
        }
        internal void GetInstance_ByInterfaceTypeMarkedClass_NotNull()
        {
            var result = NewContainer.GetInstance <BarForAttribute>();

            Assert.NotNull(result);
        }
        internal void GetInstance_ByInterface_SingleImplementation()
        {
            var result = NewContainer.GetInstance <IPerRequestFoo>();

            Assert.IsType <PerRequestFoo>(result);
        }
        internal void GetInstance_WithDependencies_SingleImplementation()
        {
            var result = NewContainer.GetInstance <IPerRequestDependencies>();

            Assert.IsType <PerRequestDependencies>(result);
        }
        internal void GetInstance_ByInterface_NotNull()
        {
            var result = NewContainer.GetInstance <IPerRequestFoo>();

            Assert.NotNull(result);
        }
Beispiel #15
0
        internal void GetInstance_WithClassDependency_ExpectedType()
        {
            var result = NewContainer.GetInstance <Service22>();

            Assert.IsType <Service21>(result.Service21);
        }
Beispiel #16
0
        internal void GetInstance_ByClass_NotNull()
        {
            var result = NewContainer.GetInstance <Service11>();

            Assert.NotNull(result);
        }
Beispiel #17
0
        internal void GetInstance_ByThirdLevelInterface_ExpectedType()
        {
            var result = NewContainer.GetInstance <IService>();

            Assert.True(result is Service11 || result is Service12 || result is Service21 || result is Service22);
        }
Beispiel #18
0
        internal void GetInstance_ByThirdLevelInterface_NotNull()
        {
            var result = NewContainer.GetInstance <IService>();

            Assert.NotNull(result);
        }
Beispiel #19
0
        internal void GetInstance_CompositionRootSpecifiedByAttribute_NotNull()
        {
            var result = NewContainer.GetInstance <CompositionRootAttributeRegistrationService>();

            Assert.NotNull(result);
        }
Beispiel #20
0
        internal void GetInstance_ByClassForGenericClass_NotNull()
        {
            var result = NewContainer.GetInstance <GenericServiceClass <IFooForGeneric> >();

            Assert.NotNull(result);
        }
        internal void GetInstance_ByInterfaceTypeMarkedClass_SameType()
        {
            var result = NewContainer.GetInstance <BarForAttribute>().GetType();

            Assert.Same(typeof(BarForAttribute), result);
        }
Beispiel #22
0
        internal void GetInstance_ByClass_NotNull()
        {
            var foo = NewContainer.GetInstance <AlwaysNewFoo>();

            Assert.NotNull(foo);
        }