本文整理汇总了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("");
}
}
示例2: CalculatedFieldAttribute_Test3
public void CalculatedFieldAttribute_Test3()
{
using (var verify = new Verify())
{
verify.ArgumentException("sources", () => new CalculatedFieldAttribute(null), "empty lists are not allowed");
}
}
示例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");
}
}
示例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");
}
}
示例5: CalculatedFieldAttribute_Test2
public void CalculatedFieldAttribute_Test2()
{
using (var verify = new Verify())
{
verify.ArgumentException("sources", () => new CalculatedFieldAttribute(null));
}
}
示例6: WeakReferenceCollection_Add
public void WeakReferenceCollection_Add()
{
using (var verify = new Verify())
{
var result = new WeakReferenceCollection<string>();
verify.ArgumentNullException("item", () => result.Add(null));
}
}
示例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");
}
}
示例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));
}
}
示例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));
}
}
示例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");
}
}
示例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");
}
}
示例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));
}
}
示例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);
}
}
示例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));
}
}
示例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");
}
}