Esempio n. 1
0
        public void Qualifier()
        {
            ServicePostRegistry.AddSingleton(typeof(IService), typeof(Service), "testqua");

            Assert.True(Sp.IsRegistered <IService>("testqua"));
            Assert.False(Sp.IsRegistered <IService>("notexist"));
        }
Esempio n. 2
0
        public void Unregister()
        {
            ServicePostRegistry.AddSingleton(typeof(IService), typeof(Service), null);

            var service = Sp.GetRequiredService <IService>();

            Assert.True(Sp.IsRegistered <IService>());
            Assert.False(service.Disposed);

            ServicePostRegistry.Unregister(typeof(IService), null);

            Assert.False(Sp.IsRegistered <IService>());
            Assert.True(service.Disposed);
        }