public void AttributeExists() { var data = new OmitIfNullAttributeData { Text = "foo", Number = 42, NullableNumber = 13 }; Assert.IsTrue(Matches(data, text_attribute.Exists(true))); Assert.IsFalse(Matches(data, text_attribute.Exists(false))); Assert.IsTrue(Matches(data, number_attribute.Exists(true))); Assert.IsFalse(Matches(data, number_attribute.Exists(false))); Assert.IsTrue(Matches(data, nullable_number_attribute.Exists(true))); Assert.IsFalse(Matches(data, nullable_number_attribute.Exists(false))); data = new OmitIfNullAttributeData(); Assert.IsFalse(Matches(data, text_attribute.Exists(true))); Assert.IsTrue(Matches(data, text_attribute.Exists(false))); Assert.IsTrue(Matches(data, number_attribute.Exists(true))); Assert.IsFalse(Matches(data, number_attribute.Exists(false))); Assert.IsFalse(Matches(data, nullable_number_attribute.Exists(true))); Assert.IsTrue(Matches(data, nullable_number_attribute.Exists(false))); Assert.IsFalse(Matches(data, text.Exists(true))); Assert.IsTrue(Matches(data, text.Exists(false))); }
public void AttributeExists () { var data = new OmitIfNullAttributeData { Text = "foo", Number = 42, NullableNumber = 13 }; Assert.IsTrue (Matches (data, text_attribute.Exists (true))); Assert.IsFalse (Matches (data, text_attribute.Exists (false))); Assert.IsTrue (Matches (data, number_attribute.Exists (true))); Assert.IsFalse (Matches (data, number_attribute.Exists (false))); Assert.IsTrue (Matches (data, nullable_number_attribute.Exists (true))); Assert.IsFalse (Matches (data, nullable_number_attribute.Exists (false))); data = new OmitIfNullAttributeData (); Assert.IsFalse (Matches (data, text_attribute.Exists (true))); Assert.IsTrue (Matches (data, text_attribute.Exists (false))); Assert.IsTrue (Matches (data, number_attribute.Exists (true))); Assert.IsFalse (Matches (data, number_attribute.Exists (false))); Assert.IsFalse (Matches (data, nullable_number_attribute.Exists (true))); Assert.IsTrue (Matches (data, nullable_number_attribute.Exists (false))); Assert.IsFalse (Matches (data, text.Exists (true))); Assert.IsTrue (Matches (data, text.Exists (false))); }