コード例 #1
0
        public void SettingsServiceReplacesType()
        {
            var container = new SparkServiceContainer();

            container.SetService <ISparkExtensionFactory>(new StubExtensionFactory());
            Assert.IsInstanceOf(typeof(StubExtensionFactory), container.GetService <ISparkExtensionFactory>());
        }
コード例 #2
0
 public void AddingServiceInstanceCallsInitialize()
 {
     var container = new SparkServiceContainer();
     var service = new TestService();
     Assert.IsFalse(service.Initialized);
     container.SetService<ITestService>(service);
     Assert.IsTrue(service.Initialized);
     Assert.AreSame(service, container.GetService<ITestService>());
 }
コード例 #3
0
        public void AddingServiceInstanceCallsInitialize()
        {
            var container = new SparkServiceContainer();
            var service   = new TestService();

            Assert.IsFalse(service.Initialized);
            container.SetService <ITestService>(service);
            Assert.IsTrue(service.Initialized);
            Assert.AreSame(service, container.GetService <ITestService>());
        }
コード例 #4
0
 public void SettingsServiceReplacesType()
 {
     var container = new SparkServiceContainer();
     container.SetService<ISparkExtensionFactory>(new StubExtensionFactory());
     Assert.IsInstanceOfType(typeof(StubExtensionFactory), container.GetService<ISparkExtensionFactory>());
 }