示例#1
0
        public void Create_AutoDetect()
        {
            var dependencyService = new DependencyBuilder().EnableServiceAutoDetection(GetType().Assembly).Build().CreateScope();
            var service           = dependencyService.Create <First.RequiresUniqueSecond>();

            Assert.NotNull(service);
            var first = Assert.IsType <First.RequiresUniqueSecond>(service);

            Assert.NotNull(first.UniqueSecond);
            Assert.IsType <Second.RequiresNone>(first.UniqueSecond);
        }
示例#2
0
        public void Create_Standard()
        {
            var dependencyService =
                new DependencyBuilder()
                .AddScoped <ISecond, Second.RequiresNone>()
                .Build().CreateScope();

            var service = dependencyService.Create <First.RequiresSecond>();

            Assert.NotNull(service);
            var first = Assert.IsType <First.RequiresSecond>(service);

            Assert.NotNull(first.Second);
            Assert.IsType <Second.RequiresNone>(first.Second);
        }