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


C# Verify类代码示例

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


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

示例1: ChangeTrackingModelBase_BasicFunctionalityTest

        public void ChangeTrackingModelBase_BasicFunctionalityTest()
        {
            using (var verify = new Verify())
            {
                var person = new ChangeTrackingPerson();
                var eventAssert = new PropertyChangedEventTest(verify, person);

                Assert.IsNull(person.FirstName);
                Assert.AreEqual("", person.LastName);

                eventAssert.ExpectNothing();

                person.FirstName = "John";

                eventAssert.ExpectEvent("FirstName");
                eventAssert.ExpectEvent("FullName");
                eventAssert.ExpectEvent("IsChangedLocal");
                eventAssert.ExpectEvent("IsChanged");

                person.LastName = "Doe";

                eventAssert.ExpectEvent("LastName");
                eventAssert.ExpectEvent("FullName");

                person.InvokeGoodPropertyMessage();
                eventAssert.ExpectEvent("FullName");

                person.InvokeAllPropertyMessage();
                eventAssert.ExpectEvent("");

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

示例2: CalculatedFieldAttribute_Test3

 public void CalculatedFieldAttribute_Test3()
 {
     using (var verify = new Verify())
     {
         verify.ArgumentException("sources", () => new CalculatedFieldAttribute(null), "empty lists are not allowed");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:7,代码来源:CalculatedFieldAttributeTests.cs

示例3: ChildPropertyChangesWithRevert

        public void ChildPropertyChangesWithRevert()
        {
            using (var verify = new Verify())
            {
                var customer = CreateCustomer(verify);
                var eventAssertCustomer = new PropertyChangedEventTest(verify, customer);

                //changes to a child in a collection
                var eventAssertOrder0 = new PropertyChangedEventTest(verify, customer.Orders[0]);
                var newOrderDate = new DateTime(2010, 5, 5);
                customer.Orders[0].OrderDate = newOrderDate;

                eventAssertOrder0.ExpectEvent("OrderDate");
                eventAssertOrder0.ExpectEvent("IsChangedLocal");
                eventAssertOrder0.ExpectEvent("IsChanged");
                eventAssertOrder0.ExpectNothing();

                //eventAssertCustomer.ExpectEvent("IsChanged");
                //eventAssertCustomer.ExpectNothing();

                //rollback
                customer.RejectChanges();
                verify.AreEqual(OrderDate1, customer.Orders[0].OrderDate, "Order date didn't roll back");

                verify.IsFalse(customer.IsChanged, "");
                eventAssertCustomer.ExpectEvent("IsChanged");

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

示例4: ExtendedObservableCollection_AddRemoveOverrideTest

 public void ExtendedObservableCollection_AddRemoveOverrideTest()
 {
     using (var verify = new Verify())
     {
         var result = new FooCollection(new[] { new Foo(), new Foo(), new Foo() });
         verify.AreEqual(3, result.AddCount, "count was incorrect");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:8,代码来源:ExtendedObservableCollectionTests.cs

示例5: CalculatedFieldAttribute_Test2

        public void CalculatedFieldAttribute_Test2()
        {
            using (var verify = new Verify())
            {
                verify.ArgumentException("sources", () => new CalculatedFieldAttribute(null));

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

示例6: WeakReferenceCollection_Add

 public void WeakReferenceCollection_Add()
 {
     using (var verify = new Verify())
     {
         var result = new WeakReferenceCollection<string>();
         verify.ArgumentNullException("item", () => result.Add(null));
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:8,代码来源:WeakReferenceCollectionTests.cs

示例7: ItemEventArgs_ItemTest

 public void ItemEventArgs_ItemTest()
 {
     using (var verify = new Verify())
     {
         var x = new ItemEventArgs<string>("xxx");
         verify.AreEqual("xxx", x.Item, "Item property was not set correctly");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:8,代码来源:ItemEventArgsTests.cs

示例8: WeakReferenceCollection_AddRange_Test1

 public void WeakReferenceCollection_AddRange_Test1()
 {
     using (var verify = new Verify())
     {
         IList<string> list = null;
         var result = new WeakReferenceCollection<string>();
         verify.ArgumentNullException("list", () => result.AddRange(list));
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:9,代码来源:WeakReferenceCollectionTests.cs

示例9: CollectionUtilities_AddRange_Test2

 public void CollectionUtilities_AddRange_Test2()
 {
     using (var verify = new Verify())
     {
         List<string> target = null;
         List<string> list = null;
         verify.ArgumentNullException("target", () => CollectionUtilities.AddRange(target, list));
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:9,代码来源:CollectionUtilitiesTests.cs

示例10: CollectionUtilities_AddRange_Test10

 public void CollectionUtilities_AddRange_Test10()
 {
     using (var verify = new Verify())
     {
         IEnumerable<int> list = new List<int> { 1, 2, 3 };
         ICollection<int> target = new ReadOnlyCollection<int>(new List<int>());
         verify.ArgumentException("target", () => CollectionUtilities.AddRange(target, list), "read-only list");
         verify.ArgumentException("target", () => CollectionUtilities.AddRange(target, 1, 2, 3), "read-only list");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:10,代码来源:CollectionUtilitiesTests.cs

示例11: CollectionUtilities_AddRange_Test11

 public void CollectionUtilities_AddRange_Test11()
 {
     using (var verify = new Verify())
     {
         var list = (new List<int> { 1, 2, 3 }).Where(x => true);
         ICollection<int> target = new ReadOnlyCollection<int>(new List<int>());
         verify.ArgumentException("target", () => CollectionUtilities.AddRange(target, list), "read-only list");
         verify.ArgumentException("target", () => CollectionUtilities.AddRange(target, 1, 2, 3), "read-only list");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:10,代码来源:CollectionUtilitiesTests.cs

示例12: ExtendedObservableCollection_RemoveNullHandlerTest

 public void ExtendedObservableCollection_RemoveNullHandlerTest()
 {
     using (var verify = new Verify())
     {
         var list = new ObservableCollectionExtended<int>();
         var result = new ReadOnlyObservableCollectionExtended<int>(list);
         verify.ArgumentNullException("eventHandler", () => result.RemoveHandler((IListener<NotifyCollectionChangedEventArgs>)null));
         verify.ArgumentNullException("eventHandler", () => result.RemoveHandler((IListener<PropertyChangedEventArgs>)null));
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:10,代码来源:ExtendedReadOnlyObservableCollectionTests.cs

示例13: PropertyMetadataCollection_CopyTo_Test3

 public void PropertyMetadataCollection_CopyTo_Test3()
 {
     using (var verify = new Verify())
     {
         var result = MetadataCache.GetMetadata(typeof(Tests.Metadata.Mock)).Properties;
         var array = new PropertyMetadata[result.Count];
         result.CopyTo(array, 0);
         foreach (var p in result)
             CollectionAssert.Contains(array, p);
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:11,代码来源:PropertyMetadataCollectionTests.cs

示例14: ExtendedObservableCollection_AddNullHandlerTest

        public void ExtendedObservableCollection_AddNullHandlerTest()
        {
            using (var verify = new Verify())
            {
                var result = new FooCollection();

                verify.ArgumentNullException("eventHandler", () => result.AddHandler((IListener<NotifyCollectionChangedEventArgs>)null));
                verify.ArgumentNullException("eventHandler", () => result.AddHandler((IListener<PropertyChangedEventArgs>)null));
                verify.ArgumentNullException("eventHandler", () => result.AddHandler((IListener<RelayedEventArgs<PropertyChangedEventArgs>>)null));
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:11,代码来源:ExtendedObservableCollectionTests.cs

示例15: ValidationResultCollection_Test1

 public void ValidationResultCollection_Test1()
 {
     using (var verify = new Verify())
     {
         var collection = new ValidationResultCollection();
         var result = collection.Add("Test", "FirstName", "LastName");
         verify.AreEqual("Test", result.ErrorMessage, "Error message");
         verify.AreEqual("FirstName", result.MemberNames.ToList()[0], "member 0");
         verify.AreEqual("LastName", result.MemberNames.ToList()[1], "member 1");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:11,代码来源:ValidationResultCollectionTests.cs


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