public void CreateSite_SetSiteName_Success(string value) { var component = new Component(); var owner = new Component(); var container = new SubNestedContainer(owner); container.Add(component, "name"); INestedSite site = Assert.IsAssignableFrom <INestedSite>(component.Site); site.Name = value; Assert.Equal(value, site.Name); }
public void CreateSite_GetSiteServiceType_ReturnsExpected() { var component = new Component(); var owner = new Component(); var container = new SubNestedContainer(owner); container.Add(component); INestedSite site = Assert.IsAssignableFrom <INestedSite>(component.Site); Assert.Same(site, site.GetService(typeof(ISite))); Assert.Same(container, site.GetService(typeof(INestedContainer))); Assert.Same(container, site.GetService(typeof(IContainer))); Assert.Null(site.GetService(typeof(INestedSite))); Assert.Null(site.GetService(typeof(int))); Assert.Null(site.GetService(null)); }
public void Add_NonNullOwnerSite_Success(string name) { var component = new Component(); var owner = new Component() { Site = new Site() { DesignMode = true } }; var container = new SubNestedContainer(owner); container.Add(component, name); INestedSite site = Assert.IsAssignableFrom <INestedSite>(component.Site); Assert.Same(component, site.Component); Assert.Same(container, site.Container); Assert.True(site.DesignMode); Assert.Equal(name, site.Name); Assert.Equal(name == null ? null : "SiteName." + name, site.FullName); }