• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Verify类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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


示例17: Fetch

        public static Page Fetch(Service service)
        {
            if (!Platform.HasInternetConnection())
            {
                return new ContentPage
                {
                    Content = new Label
                        {
                            Text = Localize.GetString("TelegramPleaseConnectToInternet"),
                            VerticalOptions = LayoutOptions.CenterAndExpand,
                            HorizontalOptions = LayoutOptions.CenterAndExpand,
                            XAlign = TextAlignment.Center,
                            Font = Font.SystemFontOfSize(18),
                        },
                    Title = Localize.GetString("TelegramSetupWizardTitle"),
                    Padding = 30,
                };
            }

            LoadSettingsIfNeeded();

            if (_cachedPage != null)
            {
                return _cachedPage;
            }

            var tabs = new TabbedPage();

            var code = new Code(service, tabs);
            var verify = new Verify(service, tabs, code);
            var info = new Info(service, tabs, verify);

            tabs.Children.Add(info);
            tabs.PropertyChanged += (sender, e) =>
                {
                    if (e.PropertyName == "CurrentPage")
                    {
                        var selected = tabs.CurrentPage;
                        if (selected is Info)
                        {
                            tabs.Children.Remove(verify);
                            tabs.Children.Remove(code);
                        }
                        if (selected is Verify)
                        {
                            tabs.Children.Remove(code);
                        }
                    }
                };

            tabs.Title = Localize.GetString("TelegramSetupWizardTitle");
            _cachedPage = tabs;
            return tabs;
        }
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:54,代码来源:Setup.cs


示例18: ExtendedObservableCollection_AddRange_Test1

        public void ExtendedObservableCollection_AddRange_Test1()
        {
            using (var verify = new Verify())
            {
                var weakNotifier = new WeakNotifier();
                var notifier = new Notifier();
                var temp = new[] { notifier, weakNotifier };

                var result = new ObservableCollectionExtended<object>();
                result.AddRange(temp);
                ConstructorAssertions(verify, result, weakNotifier, notifier);
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:13,代码来源:ExtendedObservableCollectionTests.cs


示例19: 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


示例20: ChildPropertyChangesWithCommit

        public void ChildPropertyChangesWithCommit()
        {
            using (var verify = new Verify())
            {
                var customer = CreateCustomer(verify);

                //more setup
                customer.FirstName = "Tom";
                customer.LastName = "Doe";
                customer.AcceptChanges();
                if (customer.IsChanged)
                    verify.Inconclusive("setup failed");

                var eventAssertCustomer = new PropertyChangedEventTest(verify, customer);

                customer.PropertyChanged += (s, e) => Debug.WriteLine(e.PropertyName);

                //local changes
                customer.FirstName = "Bob";
                eventAssertCustomer.ExpectEvent("FirstName");
                eventAssertCustomer.ExpectEvent("FullName");
                eventAssertCustomer.ExpectEvent("IsChangedLocal");
                eventAssertCustomer.ExpectEvent("IsChanged");
                eventAssertCustomer.ExpectNothing();
                verify.IsTrue(customer.IsChanged, "");
                verify.IsTrue(customer.IsChangedLocal, "");
                verify.AreEqual(1, customer.ChangedProperties().Count, "There should be one changed property");
                verify.AreEqual("FirstName", customer.ChangedProperties()[0], "The property should be FirstName");

                //this time IsChanged shouldn't be raised again
                customer.LastName = "Jones";
                eventAssertCustomer.ExpectEvent("LastName");
                eventAssertCustomer.ExpectEvent("FullName");
                eventAssertCustomer.ExpectNothing();
                verify.IsTrue(customer.IsChanged, "");
                verify.IsTrue(customer.IsChangedLocal, "");

                //accept changes
                customer.AcceptChanges();
                verify.IsFalse(customer.IsChanged, "");
                verify.IsFalse(customer.IsChangedLocal, "");
                eventAssertCustomer.ExpectEvent("IsChangedLocal");
                eventAssertCustomer.ExpectEvent("IsChanged");
                eventAssertCustomer.ExpectNothing();
                verify.AreEqual("Bob", customer.FirstName, "");
                verify.AreEqual("Jones", customer.LastName, "");
                verify.AreEqual(0, customer.ChangedProperties().Count, "There shouldn't be any changed properties");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:49,代码来源:ChangeTrackingTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# VerifyCodeViewModel类代码示例发布时间:2022-05-24
下一篇:
C# Verbosity类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap