public void RegisterSiteAdapterTwiceThrows() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("Foo", new MockAdapter()); collection.RegisterSite("Foo", new MockAdapter()); }
public void TryingToOverrideParentSiteThrows() { UIExtensionSiteCollection parent = new UIExtensionSiteCollection(); UIExtensionSiteCollection child = new UIExtensionSiteCollection(parent); parent.RegisterSite("Foo", new MockAdapter()); child.RegisterSite("Foo", new MockAdapter()); }
public void UnregisterSiteCreatedInParentThrows() { UIExtensionSiteCollection parent = new UIExtensionSiteCollection(); UIExtensionSiteCollection child = new UIExtensionSiteCollection(parent); parent.RegisterSite("Foo", new MockAdapter()); child.UnregisterSite("Foo"); }
public void CanCountSitesInCollection() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("Foo", new MockAdapter()); Assert.AreEqual(1, collection.Count); }
public void CanRetrieveSiteViaIndexer() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("Foo", new MockAdapter()); Assert.IsNotNull(collection["Foo"]); }
public void CanUnregisterSiteCreatedWithAdapter() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("foo", new MockAdapter()); collection.UnregisterSite("foo"); Assert.IsFalse(collection.Contains("foo")); }
public void CanFindOutIfSiteIsContainedInCollection() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("Foo", new MockAdapter()); Assert.IsTrue(collection.Contains("Foo")); Assert.IsFalse(collection.Contains("Foo2")); }
public void ContainsChecksParent() { UIExtensionSiteCollection parent = new UIExtensionSiteCollection(); UIExtensionSiteCollection child = new UIExtensionSiteCollection(parent); parent.RegisterSite("Foo", new MockAdapter()); Assert.IsTrue(child.Contains("Foo")); }
public void CountDoesNotIncludeDuplicates() { UIExtensionSiteCollection parent = new UIExtensionSiteCollection(); UIExtensionSiteCollection child = new UIExtensionSiteCollection(parent); parent.RegisterSite("Foo", new MockAdapter()); UIExtensionSite childSite = child["Foo"]; Assert.AreEqual(1, child.Count); }
public void CountIncludesParentSites() { UIExtensionSiteCollection parent = new UIExtensionSiteCollection(); UIExtensionSiteCollection child = new UIExtensionSiteCollection(parent); parent.RegisterSite("Foo", new MockAdapter()); child.RegisterSite("Bar", new MockAdapter()); Assert.AreEqual(1, parent.Count); Assert.AreEqual(2, child.Count); }
public void CanRegisterAdapterForSiteAndItIsUsedWithinTheSite() { MockAdapter adapter = new MockAdapter(); UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); object obj = new object(); collection.RegisterSite("Foo", adapter); collection["Foo"].Add(obj); Assert.AreSame(obj, adapter.AddedElement); }
public void CanRetrieveParentSiteViaIndexer() { UIExtensionSiteCollection parent = new UIExtensionSiteCollection(); UIExtensionSiteCollection child = new UIExtensionSiteCollection(parent); parent.RegisterSite("Foo", new MockAdapter()); child.RegisterSite("Bar", new MockAdapter()); Assert.IsNotNull(child["Foo"]); Assert.IsNotNull(child["Bar"]); }
public void CanUnregisterSiteCreatedWithObject() { TestableRootWorkItem wi = new TestableRootWorkItem(); wi.Services.Remove <IUIElementAdapterFactoryCatalog>(); wi.Services.AddNew <MockFactoryCatalog, IUIElementAdapterFactoryCatalog>(); UIExtensionSiteCollection collection = new UIExtensionSiteCollection(wi); collection.RegisterSite("foo", new object()); collection.UnregisterSite("foo"); Assert.IsFalse(collection.Contains("foo")); }
public void CanRegisterSiteFromObjectAndFactoryCatalogIsUsed() { TestableRootWorkItem wi = new TestableRootWorkItem(); wi.Services.Remove <IUIElementAdapterFactoryCatalog>(); MockFactoryCatalog factoryCatalog = wi.Services.AddNew <MockFactoryCatalog, IUIElementAdapterFactoryCatalog>(); UIExtensionSiteCollection collection = new UIExtensionSiteCollection(wi); object obj = new object(); collection.RegisterSite("Foo", new object()); collection["Foo"].Add(obj); Assert.AreSame(obj, factoryCatalog.Adapter.AddedElement); }
public void ItemsAddedToLocalSiteDoNotAffectItemsInParentSite() { UIExtensionSiteCollection parent = new UIExtensionSiteCollection(); UIExtensionSiteCollection child = new UIExtensionSiteCollection(parent); parent.RegisterSite("Foo", new MockAdapter()); UIExtensionSite parentSite = parent["Foo"]; UIExtensionSite childSite = child["Foo"]; parentSite.Add(new object()); childSite.Add(new object()); Assert.AreEqual(1, parentSite.Count); Assert.AreEqual(1, childSite.Count); }
public void InvalidSiteNameThrows() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); UIExtensionSite unused = collection["Foo"]; }
public void NullObjectThrows() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("Foo", (object)null); }
public void EmptySiteNameWithObjectThrows() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("", new object()); }
public void NullAdapterThrows() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("Foo", (IUIElementAdapter)null); }
public void EmptySiteNameWithAdapterThrows() { UIExtensionSiteCollection collection = new UIExtensionSiteCollection(); collection.RegisterSite("", new MockAdapter()); }