public void Resolve_Not_Register()
        {
            var many = ServiceResolver.ResolveMany <Transient>();

            Assert.NotNull(many);
            Assert.Empty(many);
        }
Exemple #2
0
        public void Resolve_Not_Register()
        {
            var many = ServiceResolver.ResolveMany <Transient>();

            Assert.NotNull(many);
            Assert.Equal(0, many.Count());
        }
        public void Resolve_Many()
        {
            var many = ServiceResolver.ResolveMany <IService>();

            Assert.NotNull(many);
            Assert.Equal(3, many.Count());
            Assert.NotEqual(many, ServiceResolver.ResolveMany <IService>());
        }
        public void Resolve_Many_Lifetime()
        {
            var many  = ServiceResolver.ResolveMany <IService>().ToArray();
            var many1 = ServiceResolver.ResolveMany <IService>().ToArray();

            Assert.NotEqual(many[0], many1[0]);
            Assert.Equal(many[1], many1[1]);
            Assert.Equal(many[2], many1[2]);
            using (var scope = ServiceResolver.CreateScope())
            {
                var many2 = scope.Resolve <IEnumerable <IService> >().ToArray();
                Assert.NotEqual(many[0], many2[0]);
                Assert.Equal(many[1], many2[1]);
                Assert.NotEqual(many[2], many2[2]);
            }
        }