Exemplo n.º 1
0
        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);
		}
Exemplo n.º 3
0
        public void CannotCastAReadOnlyLocatorToAReadWriteLocator()
        {
            Locator         innerLocator = new Locator();
            ReadOnlyLocator locator      = new ReadOnlyLocator(innerLocator);

            Assert.IsTrue(locator.ReadOnly);
            Assert.IsNull(locator as IReadWriteLocator);
        }
Exemplo n.º 4
0
        public void GenericGetWithSearchModeEnforcesDataType()
        {
            Locator         innerLocator = new Locator();
            ReadOnlyLocator locator      = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 2);

            locator.Get <string>(1, SearchMode.Local);
        }
Exemplo n.º 5
0
        public void GenericGetEnforcesDataType()
        {
            Locator         innerLocator = new Locator();
            ReadOnlyLocator locator      = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 2);

            locator.Get <string>(1);
        }
Exemplo n.º 6
0
        public void GenericGetEnforcesDataType()
        {
            Locator innerLocator = new Locator();
            ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 2);

            locator.Get<string>(1);
        }
Exemplo n.º 7
0
        public void NullParentLocatorOfInnerLocatorReturnsNullParentLocator()
        {
            Locator         locator         = new Locator();
            ReadOnlyLocator readOnlyLocator = new ReadOnlyLocator(locator);

            IReadableLocator parentLocator = readOnlyLocator.ParentLocator;

            Assert.IsNull(parentLocator);
        }
Exemplo n.º 8
0
        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);
		}
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
		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);
		}
Exemplo n.º 12
0
		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));
		}
Exemplo n.º 13
0
        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));
        }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
 public void NullInnerLocatorThrows()
 {
     ReadOnlyLocator locator = new ReadOnlyLocator(null);
 }
Exemplo n.º 16
0
		public void NullInnerLocatorThrows()
		{
			ReadOnlyLocator locator = new ReadOnlyLocator(null);
		}
Exemplo n.º 17
0
		public void GenericGetWithSearchModeEnforcesDataType()
		{
			Locator innerLocator = new Locator();
			ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

			innerLocator.Add(1, 2);

			locator.Get<string>(1, SearchMode.Local);
		}