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


C# Verify.IsFalse方法代码示例

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


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

        public void ExtendedObservableCollection_MemoryTest1()
        {
            using (var verify = new Verify())
            {
                Func<WeakReference> builder = () =>
                {

                    var result = new ObservableCollectionExtended<object>();
                    var weakNotifier = new WeakNotifier();
                    result.Add(weakNotifier);

                    return new WeakReference(result);
                };

                var wr = builder();

                Memory.CycleGC();

                verify.IsFalse(wr.IsAlive, "An item in the collection is preventing the collection from being collected");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:21,代码来源:ExtendedObservableCollectionTests.cs

示例3: MetadataCache_Test30

 public void MetadataCache_Test30()
 {
     using (var verify = new Verify())
     {
         var result = MetadataCache.GetMetadata(typeof(object));
         var mockProperty = MetadataCache.GetMetadata(typeof(Mock)).Properties.First();
         verify.AreEqual(0, result.Properties.Count, "the type System.Object has no properties");
         verify.IsFalse(result.Properties.Contains(mockProperty), "contains test");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:10,代码来源:MetadataCacheTests.cs

示例4: MetadataCache_Test25

 public void MetadataCache_Test25()
 {
     using (var verify = new Verify())
     {
         var result = MetadataCache.GetMetadata(typeof(Mock));
         PropertyMetadata p;
         verify.IsFalse(result.Properties.TryGetValue("DOES_NOT_EXIST", out p), "TryGet expected to fail here");
         verify.IsNull(p, "TryGet failed, so this should be null.");
     }
 }
开发者ID:docevaad,项目名称:Anchor,代码行数:10,代码来源:MetadataCacheTests.cs

示例5: MetadataCache_SetOnlyProperty_Test

        public void MetadataCache_SetOnlyProperty_Test()
        {
            using (var verify = new Verify())
            {
                var result = MetadataCache.GetMetadata(typeof(Mock));
                verify.IsNotNull(result, "GetMetadata returned a null");

                var setOnlyProperty = result.Properties["SetOnlyProperty"];
                verify.IsNotNull(setOnlyProperty, "property wasn't found");
                verify.IsFalse(setOnlyProperty.AffectsCalculatedFields, "not used in calculated fields");
                verify.AreEqual(0, setOnlyProperty.CalculatedFields.Length, "not used in calculated fields");
                verify.IsFalse(setOnlyProperty.CanRead, "CanRead");
                verify.IsTrue(setOnlyProperty.CanWrite, "CanWrite");
                verify.AreEqual("SetOnlyProperty", setOnlyProperty.Name, "Name");
                verify.AreEqual("SetOnlyProperty", setOnlyProperty.PropertyChangedEventArgs.PropertyName, "PropertyName");
                verify.AreEqual(typeof(int), setOnlyProperty.PropertyType, "PropertyType");

                verify.AreEqual(0, setOnlyProperty.Validators.Length, "not used in validation");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:20,代码来源:MetadataCacheTests.cs

示例6: MetadataCache_PublicProperty_Test

        public void MetadataCache_PublicProperty_Test()
        {
            using (var verify = new Verify())
            {
                var result = MetadataCache.GetMetadata(typeof(Mock));
                verify.IsNotNull(result, "GetMetadata returned a null");

                var publicProperty = result.Properties["PublicProperty"];
                verify.IsNotNull(publicProperty, "property wasn't found");
                verify.IsFalse(publicProperty.AffectsCalculatedFields, "not used in calculated fields");
                verify.AreEqual(0, publicProperty.CalculatedFields.Length, "not used in calculated fields");
                verify.IsTrue(publicProperty.CanRead, "CanRead");
                verify.IsTrue(publicProperty.CanWrite, "CanWrite");
                verify.AreEqual("PublicProperty", publicProperty.Name, "Name");
                verify.AreEqual("PublicProperty", publicProperty.PropertyChangedEventArgs.PropertyName, "PropertyName");
                verify.AreEqual(typeof(int), publicProperty.PropertyType, "PropertyType");

                verify.AreEqual(0, publicProperty.Validators.Length, "not used in validation");

                verify.IsTrue(result.Constructors.HasDefaultConstructor, "this should have a automatically implemented default constructor");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:22,代码来源:MetadataCacheTests.cs

示例7: MetadataCache_DefaultConstructor_Test

        public void MetadataCache_DefaultConstructor_Test()
        {
            using (var verify = new Verify())
            {
                var a = MetadataCache.GetMetadata(typeof(AutoConstructor));
                verify.IsTrue(a.Constructors.HasDefaultConstructor, "AutoConstructor should have a automatically implemented default constructor");

                var b = MetadataCache.GetMetadata(typeof(DefaultConstructor));
                verify.IsTrue(b.Constructors.HasDefaultConstructor, "DefaultConstructor should have a automatically implemented default constructor");

                var c = MetadataCache.GetMetadata(typeof(DefaultConstructorPrivateClass));
                verify.IsTrue(c.Constructors.HasDefaultConstructor, "DefaultConstructorPrivateClass should have a automatically implemented default constructor");

                var d = MetadataCache.GetMetadata(typeof(PrivateDefaultConstructor));
                verify.IsFalse(d.Constructors.HasDefaultConstructor, "PrivateDefaultConstructor does not have a visible default constructor");

                var e = MetadataCache.GetMetadata(typeof(NonDefaultConstructor));
                verify.IsFalse(e.Constructors.HasDefaultConstructor, "NonDefaultConstructor does not have a default constructor");

                var f = MetadataCache.GetMetadata(typeof(StaticConstructor));
                verify.IsTrue(f.Constructors.HasDefaultConstructor, "NonDefaultConstructor does not have a default constructor");

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

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

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

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

示例11: LocalChangesWithCommit

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

                //local changes
                customer.FirstName = "Tom";
                eventAssertCustomer.ExpectEvent("FirstName");
                eventAssertCustomer.ExpectEvent("FullName");
                eventAssertCustomer.ExpectEvent("IsChangedLocal");
                eventAssertCustomer.ExpectEvent("IsChanged");
                eventAssertCustomer.ExpectNothing();
                verify.IsTrue(customer.IsChanged, "");
                verify.IsTrue(customer.IsChangedLocal, "");

                //accept changes
                customer.AcceptChanges();
                eventAssertCustomer.ExpectEvent("IsChangedLocal");
                eventAssertCustomer.ExpectEvent("IsChanged");
                eventAssertCustomer.ExpectNothing();
                verify.IsFalse(customer.IsChanged, "");
                verify.IsFalse(customer.IsChangedLocal, "");

                //more 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, "");

                //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, "");
            }
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:54,代码来源:ChangeTrackingTests.cs

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