当前位置: 首页>>代码示例>>C#>>正文


C# List.WithUpdates方法代码示例

本文整理汇总了C#中Microsoft.VisualStudio.TestTools.UnitTesting.List.WithUpdates方法的典型用法代码示例。如果您正苦于以下问题:C# List.WithUpdates方法的具体用法?C# List.WithUpdates怎么用?C# List.WithUpdates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.VisualStudio.TestTools.UnitTesting.List的用法示例。


在下文中一共展示了List.WithUpdates方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Distinct_ObservableSource_NoUpdateWhenDetached

        public void Distinct_ObservableSource_NoUpdateWhenDetached()
        {
            var update = false;
            var coll = new List<int>() { 1, 2, 2, 3 };

            var test = coll.WithUpdates().Distinct();

            test.CollectionChanged += (o, e) => update = true;

            Assert.AreEqual(3, test.Count());
            Assert.IsFalse(update);

            test.Detach();
            update = false;

            coll.Add(4);

            Assert.IsFalse(update);

            test.Attach();

            Assert.IsTrue(update);
            Assert.AreEqual(4, test.Count());
            update = true;

            coll.Remove(4);

            Assert.IsTrue(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:29,代码来源:DistinctTest.cs

示例2: Min_NoObservableSourceNewMinAdded_NoUpdate

        public void Min_NoObservableSourceNewMinAdded_NoUpdate()
        {
            var update = false;
            var coll = new List<int>() { 1, 2, 3 };

            var test = Observable.Expression(() => coll.WithUpdates().Min());

            test.ValueChanged += (o, e) => update = true;

            Assert.AreEqual(1, test.Value);
            Assert.AreEqual(1, coll.WithUpdates().Min());
            Assert.IsFalse(update);

            coll.Add(0);

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:17,代码来源:MinTests.cs

示例3: LambdaMax_NoObservableSourceNewMaxAdded_NoUpdate

        public void LambdaMax_NoObservableSourceNewMaxAdded_NoUpdate()
        {
            var update = false;
            var coll = new List<Dummy<int>>() { new Dummy<int>(-1), new Dummy<int>(-2), new Dummy<int>(-3) };

            var test = Observable.Expression(() => coll.WithUpdates().Max(d => d.Item));

            test.ValueChanged += (o, e) => update = true;

            Assert.AreEqual(-1, test.Value);
            Assert.AreEqual(-1, coll.WithUpdates().Max(d => d.Item));
            Assert.IsFalse(update);

            coll.Add(new Dummy<int>(0));

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:17,代码来源:LambdaMaxTests.cs

示例4: Distinct_NoObservableSourceNewItemAdded_NoUpdate

        public void Distinct_NoObservableSourceNewItemAdded_NoUpdate()
        {
            var update = false;
            var coll = new List<int>() { 1, 2, 2, 3 };

            var test = coll.WithUpdates().Distinct();

            test.CollectionChanged += (o, e) => update = true;

            Assert.AreEqual(3, test.Count());
            Assert.IsFalse(update);

            coll.Add(4);

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:16,代码来源:DistinctTest.cs

示例5: Count_NoObservableSourceItemAdded_NoUpdate

        public void Count_NoObservableSourceItemAdded_NoUpdate()
        {
            var update = false;
            var coll = new List<int>() { 1, 2, 3 };

            var test = Observable.Expression(() => coll.WithUpdates().Count());

            test.ValueChanged += (o, e) => update = true;

            Assert.AreEqual(3, test.Value);
            Assert.IsFalse(update);

            coll.Add(4);

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:16,代码来源:CountTest.cs

示例6: Contains_NoObservableSourceElementAdded_NoUpdate

        public void Contains_NoObservableSourceElementAdded_NoUpdate()
        {
            var update = false;
            var coll = new List<int>() { 1, 2, 3 };

            var test = Observable.Expression(() => coll.WithUpdates().Contains(4));

            test.ValueChanged += (o, e) => update = true;

            Assert.IsFalse(test.Value);
            Assert.IsFalse(update);

            coll.Add(4);

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:16,代码来源:ContainsTests.cs

示例7: Any_NoObservableSourceItemRemovedThusEmptyCollection_NoUpdate

        public void Any_NoObservableSourceItemRemovedThusEmptyCollection_NoUpdate()
        {
            var update = false;
            var coll = new List<int>() { 1 };

            var test = Observable.Expression(() => coll.WithUpdates().Any());

            test.ValueChanged += (o, e) => update = true;

            Assert.IsTrue(test.Value);
            Assert.IsFalse(update);

            coll.Remove(1);

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:16,代码来源:AnyTest.cs

示例8: FirstOrDefault_NoObservableSourceFirstItemAdded_NoUpdate

        public void FirstOrDefault_NoObservableSourceFirstItemAdded_NoUpdate()
        {
            var update = false;
            var coll = new List<string>();

            var test = Observable.Expression(() => coll.WithUpdates().FirstOrDefault());

            test.ValueChanged += (o, e) => update = true;

            Assert.IsNull(test.Value);
            Assert.IsFalse(update);

            coll.Add("42");

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:16,代码来源:FirstOrDefaultTests.cs

示例9: OfTypeTests_NoObservableSourceItemRemoved_NoUpdate

        public void OfTypeTests_NoObservableSourceItemRemoved_NoUpdate()
        {
            var update = false;
            var coll = new List<object>() { 23, "42", null };

            var test = coll.WithUpdates().OfType<string>();

            test.CollectionChanged += (o, e) => update = true;

            test.AssertSequence("42");
            Assert.IsFalse(update);

            coll.Remove("42");

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:16,代码来源:OfTypeTests.cs

示例10: OfTypeTests_ItemOfOtherTypeAdded_NoUpdate

        public void OfTypeTests_ItemOfOtherTypeAdded_NoUpdate()
        {
            var update = false;
            var coll = new List<object>() { 23, "42", null };

            var test = coll.WithUpdates().OfType<string>();

            test.CollectionChanged += (o, e) => update = true;

            test.AssertSequence("42");
            Assert.IsFalse(update);

            coll.Add(2.0);

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:16,代码来源:OfTypeTests.cs

示例11: OrderBy_NoObservableSourceItemAdded_NoUpdate

		public void OrderBy_NoObservableSourceItemAdded_NoUpdate()
		{
			var update = false;
			var coll = new List<string>() { "C", "A", "D" };

			var test = coll.WithUpdates().OrderBy(item => item);

			test.CollectionChanged += (o, e) => update = true;

			test.AssertSequence("A", "C", "D");
            Assert.AreEqual(3, test.Sequences.Count());
			Assert.IsFalse(update);

			coll.Add("B");

			Assert.IsFalse(update);
		}
开发者ID:FrederikP,项目名称:NMF,代码行数:17,代码来源:OrderByTest.cs

示例12: Concat_NoObservableSource1ItemAdded_NoUpdate

        public void Concat_NoObservableSource1ItemAdded_NoUpdate()
        {
            var update = false;
            var coll1 = new List<int>() { 1, 2, 3 };
            var coll2 = new List<int>() { 4, 5, 6 };

            var test = coll1.WithUpdates().Concat(coll2);

            test.CollectionChanged += (o, e) => update = true;

            test.AssertSequence(1, 2, 3, 4, 5, 6);
            Assert.IsFalse(update);

            coll1.Add(4);

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:17,代码来源:ConcatTests.cs

示例13: Select_NoObservableSourceItemAdded_NoUpdate

        public void Select_NoObservableSourceItemAdded_NoUpdate()
        {
            var update = false;
            ICollection<Dummy<string>> coll = new List<Dummy<string>>();

            var test = coll.WithUpdates().Select(d => d.Item);

            test.CollectionChanged += (o, e) => update = true;

            Assert.IsTrue(!test.Any());
            Assert.IsFalse(update);

            coll.Add(new Dummy<string>() { Item = "42" });

            Assert.IsTrue(!test.Any());
            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:17,代码来源:SelectTest.cs

示例14: All_NoObservableSourceItemRemoved_NoUpdate

        public void All_NoObservableSourceItemRemoved_NoUpdate()
        {
            var update = false;

            var coll = new List<int>() { 1, 2, 3, -1 };

            var test = Observable.Expression(() => coll.WithUpdates().All(i => i > 0));

            test.ValueChanged += (o, e) => update = true;

            Assert.IsFalse(test.Value);
            Assert.IsFalse(update);

            coll.Remove(-1);

            Assert.IsFalse(update);
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:17,代码来源:AllTests.cs

示例15: Where_NoObservableSourceSuppressedAdded_NoUpdates

		public void Where_NoObservableSourceSuppressedAdded_NoUpdates()
		{
			var update = false;
			ICollection<Dummy<bool>> coll = new List<Dummy<bool>>();
			var dummy = new Dummy<bool>() { Item = false };

			var test = coll.WithUpdates().Where(d => d.Item);

			test.CollectionChanged += (o, e) => update = true;

			Assert.IsFalse(Sys.Contains(test, dummy));
			Assert.IsFalse(update);

			coll.Add(dummy);

			Assert.IsFalse(update);
			Assert.IsFalse(Sys.Contains(test, dummy));
		}
开发者ID:FrederikP,项目名称:NMF,代码行数:18,代码来源:WhereTest.cs


注:本文中的Microsoft.VisualStudio.TestTools.UnitTesting.List.WithUpdates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。