public void SimpleContainment() { ContainerComponent cc = new ContainerComponent(); cc.Add(new Component()); SimpleComponent sc = new SimpleComponent(); cc.Add(sc); Assert.IsTrue(sc.sited); }
public void ProviderContainment() { ServiceContainer sc = new ServiceContainer(); sc.AddService(typeof(ContainerComponentTests), this); Assert.AreSame(this, ((IServiceProvider)sc).GetService(typeof(ContainerComponentTests))); ContainerComponent cc = (ContainerComponent)sc; Assert.AreSame(this, ((IServiceProvider)cc).GetService(typeof(ContainerComponentTests))); }
public void ServiceContainment() { ServiceContainer parent = new ServiceContainer(); parent.AddService(typeof(ContainerComponentTests), this); ContainerComponent child = new ContainerComponent(); SimpleComponent sc = new SimpleComponent(); child.Add(sc); Assert.IsNull(((IServiceProvider)child).GetService( typeof(ContainerComponentTests))); parent.Add(child); Assert.AreSame(this, ((IServiceProvider)parent).GetService( typeof(ContainerComponentTests))); }