コード例 #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);
        }
コード例 #2
0
		public void CannotCastAReadOnlyLocatorToAReadWriteLocator()
		{
			Locator innerLocator = new Locator();
			ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

			Assert.IsTrue(locator.ReadOnly);
			Assert.IsNull(locator as IReadWriteLocator);
		}
コード例 #3
0
        public void CannotCastAReadOnlyLocatorToAReadWriteLocator()
        {
            Locator         innerLocator = new Locator();
            ReadOnlyLocator locator      = new ReadOnlyLocator(innerLocator);

            Assert.IsTrue(locator.ReadOnly);
            Assert.IsNull(locator as IReadWriteLocator);
        }
コード例 #4
0
        public void GenericGetWithSearchModeEnforcesDataType()
        {
            Locator         innerLocator = new Locator();
            ReadOnlyLocator locator      = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 2);

            locator.Get <string>(1, SearchMode.Local);
        }
コード例 #5
0
        public void GenericGetEnforcesDataType()
        {
            Locator         innerLocator = new Locator();
            ReadOnlyLocator locator      = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 2);

            locator.Get <string>(1);
        }
コード例 #6
0
        public void GenericGetEnforcesDataType()
        {
            Locator innerLocator = new Locator();
            ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

            innerLocator.Add(1, 2);

            locator.Get<string>(1);
        }
コード例 #7
0
ファイル: ReadOnlyLocatorTest.cs プロジェクト: formist/LinkMe
        public void NullParentLocatorOfInnerLocatorReturnsNullParentLocator()
        {
            Locator         locator         = new Locator();
            ReadOnlyLocator readOnlyLocator = new ReadOnlyLocator(locator);

            IReadableLocator parentLocator = readOnlyLocator.ParentLocator;

            Assert.IsNull(parentLocator);
        }
コード例 #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);
        }
コード例 #9
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);
		}
コード例 #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);
        }
コード例 #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);
		}
コード例 #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));
		}
コード例 #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));
        }
コード例 #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);
        }
コード例 #15
0
 public void NullInnerLocatorThrows()
 {
     ReadOnlyLocator locator = new ReadOnlyLocator(null);
 }
コード例 #16
0
		public void NullInnerLocatorThrows()
		{
			ReadOnlyLocator locator = new ReadOnlyLocator(null);
		}
コード例 #17
0
		public void GenericGetWithSearchModeEnforcesDataType()
		{
			Locator innerLocator = new Locator();
			ReadOnlyLocator locator = new ReadOnlyLocator(innerLocator);

			innerLocator.Add(1, 2);

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