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


C# Verify.Inconclusive方法代码示例

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


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

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

示例2: CreateCustomer

        Customer CreateCustomer(Verify verify)
        {
            var result = new Customer();
            var order1 = new Order() { OrderDate = OrderDate1 };
            order1.Lines.Add(new OrderLine(1.95m, 10m));
            order1.Lines.Add(new OrderLine(12.95m, 1m));
            order1.Lines.Add(new OrderLine(19.95m, 2m));
            result.Orders.Add(order1);

            var order2 = new Order() { OrderDate = OrderDate2 };
            order2.Lines.Add(new OrderLine(2.50m, 5m));
            order2.Lines.Add(new OrderLine(1.75m, 12m));
            order2.Lines.Add(new OrderLine(.50m, 4m));
            result.Orders.Add(order2);

            result.AcceptChanges();

            if (result.IsChanged)
                verify.Inconclusive("Unable to setup test. New Customer object is indicating changes.");

            if (order1.IsChangedLocal)
                verify.Inconclusive("Unable to setup test. The order1 object is indicating local changes.");

            if (order1.IsChanged)
                verify.Inconclusive("Unable to setup test. The order1 object is indicating changes.");

            if (order2.IsChangedLocal)
                verify.Inconclusive("Unable to setup test. The order2 object is indicating local changes.");

            if (order2.IsChanged)
                verify.Inconclusive("Unable to setup test. The order2 object is indicating changes.");

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


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