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


C# Verify.ItemsAreEqual方法代码示例

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


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

示例1: CalculatedFieldAttribute_Test1

        public void CalculatedFieldAttribute_Test1()
        {
            using (var verify = new Verify())
            {
                string fields = "AAA, BBB,CCC";
                var result = new CalculatedFieldAttribute(fields);
                verify.AreEqual(fields, result.Sources, "the field list shouldn't be altered in any way");
                verify.ItemsAreEqual(new[] { "AAA", "BBB", "CCC" }, result.SourceProperties, "");

            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:11,代码来源:CalculatedFieldAttributeTests.cs

示例2: CollectionUtilities_AddRange_Test3

        public void CollectionUtilities_AddRange_Test3()
        {
            using (var verify = new Verify())
            {
                List<string> target = new List<string>();
                List<string> list = new List<string>();
                target.Add("AAA");
                list.Add("BBB");
                list.Add("CCC");

                CollectionUtilities.AddRange(target, list);
                verify.ItemsAreEqual(new[] { "AAA", "BBB", "CCC" }, target, "AddRange should have added 3 items");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:14,代码来源:CollectionUtilitiesTests.cs

示例3: CollectionUtilities_RemoveRange_Test4

        public void CollectionUtilities_RemoveRange_Test4()
        {
            using (var verify = new Verify())
            {
                List<string> list = new List<string>();
                list.Add("AAA");
                list.Add("BBB");
                list.Add("CCC");
                CollectionUtilities.RemoveRange(list, 1, 2);

                verify.ItemsAreEqual(new[] { "AAA" }, list, "RemoveRange should have left 1 item");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:13,代码来源:CollectionUtilitiesTests.cs

示例4: WeakReferenceCollection_Clear_Test1

        public void WeakReferenceCollection_Clear_Test1()
        {
            using (var verify = new Verify())
            {
                string item1 = "AAA";
                string item2 = "BBB";

                var list = new List<string>();
                list.Add(item1);
                list.Add(item2);

                var result = new WeakReferenceCollection<string>();
                result.AddRange(list);

                verify.ItemsAreEqual(new[] { "AAA", "BBB" }, result, "Two items should have been in the collection.");

                result.Clear();

                verify.IsEmpty(result, "");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:21,代码来源:WeakReferenceCollectionTests.cs

示例5: WeakReferenceCollection_Remove_Test1

        public void WeakReferenceCollection_Remove_Test1()
        {
            using (var verify = new Verify())
            {
                string item1 = "AAA";
                string item2 = "BBB";

                var list = new List<string>();
                list.Add(item1);
                list.Add(item2);

                var result = new WeakReferenceCollection<string>();
                result.AddRange(list);
                verify.ItemsAreEqual(new[] { "AAA", "BBB" }, result, "Two items should have been in the collection.");

                verify.IsTrue(result.Remove(item2), "item 1 should have been removable");

                verify.ItemsAreEqual(new[] { "AAA" }, result, "One item should have been left in the collection.");

                verify.IsTrue(result.Remove(item1), "item 2 should have been removable");

                verify.IsEmpty(result, "Removal failed");

                verify.IsFalse(result.Remove(item1), "item was already removed");

                verify.ArgumentNullException("item", () => result.Remove(null));

            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:29,代码来源:WeakReferenceCollectionTests.cs

示例6: WeakReferenceCollection_GetEnumerator

        public void WeakReferenceCollection_GetEnumerator()
        {
            using (var verify = new Verify())
            {
                string item1 = "AAA";
                string item2 = "BBB";

                var list = new List<string>();
                list.Add(item1);
                list.Add(item2);

                var result = new WeakReferenceCollection<string>();
                result.AddRange(list);

                verify.ItemsAreEqual((IEnumerable<string>)new[] { "AAA", "BBB" }, list, "");

                verify.IsFalse(((ICollection<string>)result).IsReadOnly, "Is read only should be false");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:19,代码来源:WeakReferenceCollectionTests.cs

示例7: WeakReferenceCollection_CopyTo_Test3

 public void WeakReferenceCollection_CopyTo_Test3()
 {
     using (var verify = new Verify())
     {
         var result = new WeakReferenceCollection<string>();
         result.Add("AAA");
         var array = new string[1];
         result.CopyTo(array, 0);
         verify.ItemsAreEqual(new[] { "AAA" }, array, "");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:11,代码来源:WeakReferenceCollectionTests.cs

示例8: ExtendedReadOnlyObservableCollection_MemoryTest

        public void ExtendedReadOnlyObservableCollection_MemoryTest()
        {
            using (var verify = new Verify())
            {

                Func<WeakReference> builder = () =>
                {

                    var source = new ObservableCollectionExtended<int>();
                    var target = new ReadOnlyObservableCollectionExtended<int>(source);

                    var sourceEvents = new Queue<NotifyCollectionChangedEventArgs>();
                    var targetEvents = new Queue<NotifyCollectionChangedEventArgs>();

                    var sourceEvents2 = new Queue<PropertyChangedEventArgs>();
                    var targetEvents2 = new Queue<PropertyChangedEventArgs>();

                    source.CollectionChanged += (s, e) => sourceEvents.Enqueue(e);
                    target.CollectionChanged += (s, e) => targetEvents.Enqueue(e);

                    source.PropertyChanged += (s, e) => sourceEvents2.Enqueue(e);
                    target.PropertyChanged += (s, e) => targetEvents2.Enqueue(e);

                    Memory.CycleGC();

                    source.Add(1);
                    source.Add(2);
                    source.Add(3);

                    verify.AreEqual(3, sourceEvents.Count, "NotifyCollectionChangedEventArgs in source was wrong");
                    verify.AreEqual(3, targetEvents.Count, "NotifyCollectionChangedEventArgs in target was wrong");
                    verify.AreEqual(6, sourceEvents2.Count, "PropertyChangedEventArgs in source was wrong.  There should be 2 per add.");
                    verify.AreEqual(6, targetEvents2.Count, "PropertyChangedEventArgs in target was wrong. There should be 2 per add.");

                    verify.ItemsAreEqual(source, target, "");

                    return new WeakReference(target);
                };

                var wr = builder();

                Memory.CycleGC();

                verify.IsFalse(wr.IsAlive, "wr wasn't GC'd");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:46,代码来源:ExtendedReadOnlyObservableCollectionTests.cs


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