Exemplo n.º 1
0
        public void SettingsServiceReplacesType()
        {
            var container = new SparkServiceContainer();

            container.SetService <ISparkExtensionFactory>(new StubExtensionFactory());
            Assert.IsInstanceOf(typeof(StubExtensionFactory), container.GetService <ISparkExtensionFactory>());
        }
 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>());
 }
Exemplo n.º 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>());
        }
 public void SettingsServiceReplacesType()
 {
     var container = new SparkServiceContainer();
     container.SetService<ISparkExtensionFactory>(new StubExtensionFactory());
     Assert.IsInstanceOfType(typeof(StubExtensionFactory), container.GetService<ISparkExtensionFactory>());
 }