public void CanEnumerateItemsInReadOnlyLocator() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 1); innerLocator.Add(2, 2); bool sawOne = false; bool sawTwo = false; foreach (KeyValuePair <object, object> pair in locator) { if (pair.Key.Equals(1)) { sawOne = true; } if (pair.Key.Equals(2)) { sawTwo = true; } } Assert.IsTrue(sawOne); Assert.IsTrue(sawTwo); }
public void CannotCastAReadOnlyLocatorToAReadWriteLocator() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); Assert.IsTrue(locator.ReadOnly); Assert.IsNull(locator as IReadWriteLocator); }
public void CannotCastAReadOnlyLocatorToAReadWriteLocator() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); Assert.IsTrue(locator.ReadOnly); Assert.IsNull(locator as IReadWriteLocator); }
public void GenericGetWithSearchModeEnforcesDataType() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 2); locator.Get <string>(1, SearchMode.Local); }
public void GenericGetEnforcesDataType() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 2); locator.Get <string>(1); }
public void GenericGetEnforcesDataType() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 2); locator.Get<string>(1); }
public void NullParentLocatorOfInnerLocatorReturnsNullParentLocator() { Locator locator = new Locator(); ReadOnlyLocator readOnlyLocator = new ReadOnlyLocator(locator); IReadableLocator parentLocator = readOnlyLocator.ParentLocator; Assert.IsNull(parentLocator); }
public void ReadOnlyLocatorCountReflectsInnerLocatorCount() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 1); innerLocator.Add(2, 2); Assert.AreEqual(innerLocator.Count, locator.Count); }
public void ReadOnlyLocatorCountReflectsInnerLocatorCount() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 1); innerLocator.Add(2, 2); Assert.AreEqual(innerLocator.Count, locator.Count); }
public void ParentLocatorOfReadOnlyLocatorIsAlsoReadOnly() { Locator parentInnerLocator = new Locator(); Locator childInnerLocator = new Locator(parentInnerLocator); ReadOnlyLocator childLocator = new ReadOnlyLocator(childInnerLocator); IReadableLocator parentLocator = childLocator.ParentLocator; Assert.IsTrue(parentLocator.ReadOnly); Assert.IsNull(parentLocator as IReadWriteLocator); }
public void ParentLocatorOfReadOnlyLocatorIsAlsoReadOnly() { Locator parentInnerLocator = new Locator(); Locator childInnerLocator = new Locator(parentInnerLocator); ReadOnlyLocator childLocator = new ReadOnlyLocator(childInnerLocator); IReadableLocator parentLocator = childLocator.ParentLocator; Assert.IsTrue(parentLocator.ReadOnly); Assert.IsNull(parentLocator as IReadWriteLocator); }
public void ItemsContainedInLocatorContainedInReadOnlyLocator() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 1); innerLocator.Add(2, 2); Assert.IsTrue(locator.Contains(1)); Assert.IsTrue(locator.Contains(2)); Assert.IsFalse(locator.Contains(3)); }
public void ItemsContainedInLocatorContainedInReadOnlyLocator() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 1); innerLocator.Add(2, 2); Assert.IsTrue(locator.Contains(1)); Assert.IsTrue(locator.Contains(2)); Assert.IsFalse(locator.Contains(3)); }
public void CanEnumerateItemsInReadOnlyLocator() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 1); innerLocator.Add(2, 2); bool sawOne = false; bool sawTwo = false; foreach (KeyValuePair<object, object> pair in locator) { if (pair.Key.Equals(1)) sawOne = true; if (pair.Key.Equals(2)) sawTwo = true; } Assert.IsTrue(sawOne); Assert.IsTrue(sawTwo); }
public void NullInnerLocatorThrows() { ReadOnlyLocator locator = new ReadOnlyLocator(null); }
public void NullInnerLocatorThrows() { ReadOnlyLocator locator = new ReadOnlyLocator(null); }
public void GenericGetWithSearchModeEnforcesDataType() { Locator innerLocator = new Locator(); ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator); innerLocator.Add(1, 2); locator.Get<string>(1, SearchMode.Local); }