示例#1
0
        public void CompoundListPrepend()
        {
            var         source = new TestDataSource();
            IDataSource s      = source;

            source.DataItems.Add(new DataItem("Foo1", "Bar1"));
            source.DataItems.Add(new DataItem("Foo2", "Bar2"));

            var compoundList = new CompoundCollection {
                MainList = s.Data
            };
            var prependItem = new DataItem("Pre1", "Val1");

            compoundList.PrependList.Add(prependItem);

            Assert.AreEqual(prependItem, compoundList[0]);
            Assert.AreEqual(source.DataItems[0], s.Data[0]);
            Assert.AreEqual(source.DataItems[1], s.Data[1]);

            Assert.AreEqual(source.DataItems[0], compoundList[1]);
            Assert.AreEqual(source.DataItems[1], compoundList[2]);

            s.MaskKey("Foo1");

            Assert.AreEqual(source.DataItems[1], compoundList[1]);
        }
		public void CompoundListPrepend ()
		{
			var source = new TestDataSource ();
			IDataSource s = source;
			source.DataItems.Add (new DataItem ("Foo1", "Bar1"));
			source.DataItems.Add (new DataItem ("Foo2", "Bar2"));

			var compoundList = new CompoundCollection {
				MainList = s.Data
			};
			var prependItem = new DataItem ("Pre1", "Val1");
			compoundList.PrependList.Add (prependItem);

			Assert.AreEqual (prependItem, compoundList[0]);
			Assert.AreEqual (source.DataItems[0], s.Data[0]);
			Assert.AreEqual (source.DataItems[1], s.Data[1]);

			Assert.AreEqual (source.DataItems[0], compoundList[1]);
			Assert.AreEqual (source.DataItems[1], compoundList[2]);

			s.MaskKey ("Foo1");

			Assert.AreEqual (source.DataItems[1], compoundList[1]);
		}