public void PropertySet_ValidateWithProperty_IgnoreIfDefault() { var expected = new TestObjectCustomValidation(); var actual = new TestObjectCustomValidation { CustomValidation = "ValidationCustom" }; Assert.That(actual, Entity.Is.EqualTo(expected)); }
public void PropertySet_ExpectingNullObject() { TestObjectCustomValidation expected = null; var ex = Assert.Throws(typeof(ArgumentNullException), () => Entity.Is.EqualTo(expected)); Console.WriteLine(ex.Message); Assert.That(ex.Message, Is.EqualTo("Expected can't be null\r\nParameter name: expected"), "Assertion message"); }
public void PropertySet_ValidateWithProperty() { var expected = new TestObjectCustomValidation { CustomValidation = "Validation" }; var actual = new TestObjectCustomValidation { CustomValidation = "ValidationCustom" }; Assert.That(actual, Entity.EqualTo(expected)); }
public void PropertySet_ExpectingNotNullObject_ActualNull() { var expected = new TestObjectCustomValidation { CustomValidation = "Validation" }; TestObjectCustomValidation actual = null; var messageCheck = new MessageCheck("Property Set is not equal"); messageCheck.AddObjectLine(typeof(TestObjectCustomValidation).ToString(), "Null"); var ex = Assert.Throws(typeof(AssertionException), () => Assert.That(actual, Entity.Is.EqualTo(expected))); Console.WriteLine(ex.Message); messageCheck.Check(ex); }
public void PropertySet_ValidateWithProperty_Negative() { var expected = new TestObjectCustomValidation { CustomValidation = "Validation" }; var actual = new TestObjectCustomValidation { CustomValidation = "Validation" }; var messageCheck = new MessageCheck("Property Set is not equal"); messageCheck.AddPropertyLine(expected.ValidationCustomValidation, actual.CustomValidation, "CustomValidation"); var ex = Assert.Throws(typeof(AssertionException), () => Assert.That(actual, Entity.Is.EqualTo(expected))); messageCheck.Check(ex); }
public void PropertySet_ByInterface_IncompatibleInterface() { var expected = new TestObjectCustomValidation { CustomValidation = "Validation" }; var actual = new TestObjectCustomValidation { CustomValidation = "Validation" }; var ex = Assert.Throws(typeof(ImproperTypeUsageException), () => Assert.That(actual, Entity.EqualTo(expected).ByInterface(typeof(TestObjectWithChildList)))); Console.WriteLine(ex.Message); Assert.That(ex.Message, Is.EqualTo( "Could not get property Child from object of type UsageExample.PropertySetValidatorTests.TestObjects.TestObjectCustomValidation"), "Assertion message"); }