public void ResolvesType_AsSingleton()
		{
			var micro = new MicroConfiguration("Test", null, null);

			micro.Register(typeof(IInstance), () => new TestInstance(), true);
			
			var instance = micro.Resolve<IInstance>();

			Assert.NotNull(instance);

			var instance2 = micro.Resolve<IInstance>();

			Assert.Equal(instance.InstanceGuid, instance2.InstanceGuid);
		}
        public void Micro_ResolvesType_AsSingleton()
        {
            var micro = new MicroConfiguration("Test");

            micro.Register(typeof(IInstance), () => new TestInstance(), true);

            var instance = micro.Resolve <IInstance>();

            Assert.IsNotNull(instance);

            var instance2 = micro.Resolve <IInstance>();

            Assert.AreEqual(instance.InstanceGuid, instance2.InstanceGuid);
        }
        public void ResolvesType_AsInstance()
        {
            var micro = new MicroConfiguration("Test", null, null);

            micro.Register(typeof(IInstance), () => new TestInstance(), false);

            var instance = micro.Resolve <IInstance>();

            Assert.NotNull(instance);

            var instance2 = micro.Resolve <IInstance>();

            Assert.NotEqual(instance.InstanceGuid, instance2.InstanceGuid);
        }
示例#4
0
        public void ResolvesType()
        {
            var micro = new MicroConfiguration("Test", null);

            micro.Register(typeof(ITest), () => new Test(), true);

            var instance = micro.Resolve <ITest>();

            Assert.NotNull(instance);
        }
		public void ResolvesType()
		{
			var micro = new MicroConfiguration("Test", null, null);

			micro.Register(typeof(ITest), () => new Test(), true);

			var instance = micro.Resolve<ITest>();

			Assert.NotNull(instance);
		}
示例#6
0
        public void Throws_WhenConstructingUnregisteredType()
        {
            var micro = new MicroConfiguration("Test", null);

            Assert.Throws <MicroResolutionException>(() => micro.Resolve <ITest>());
        }
		public void Throws_WhenConstructingUnregisteredType()
		{
			var micro = new MicroConfiguration("Test", null, null);

			Assert.Throws<MicroResolutionException>(() => micro.Resolve<ITest>());
		}