Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@ -46,14 +46,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
var sla = new CreditCardAttribute ();
Assert.IsTrue (sla.IsValid (null), "#A1-1");
Assert.IsFalse (sla.IsValid (String.Empty), "#A1-2");
Assert.IsTrue (sla.IsValid (String.Empty), "#A1-2");
Assert.IsFalse (sla.IsValid ("string"), "#A1-3");
Assert.IsTrue (sla.IsValid ("378282246310005"), "#A1-4");
Assert.IsTrue (sla.IsValid ("3782-8224-6310-005"), "#A1-5");
Assert.IsTrue (sla.IsValid ("371449635398431"), "#A-6");
#if false
Assert.IsFalse (sla.IsValid ("371449635498431"), "#A-6b");
#endif
Assert.IsFalse (sla.IsValid (true), "#A1-7");
Assert.IsFalse (sla.IsValid (DateTime.Now), "#A1-8");
}

View File

@ -71,7 +71,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
public class DisplayAttributeTests
{
const string property_not_set_message = "The {0} property has not been set. Use the Get{0} method to get the value.";
const string localization_failed_message = "Cannot retrieve property '{0}' because localization failed. Type '{1} is not public or does not contain a public static string property with the name '{2}'.";
const string localization_failed_message = "Cannot retrieve property '{0}' because localization failed. Type '{1}' is not public or does not contain a public static string property with the name '{2}'.";
[Test]
public void StringProperties_ReturnLiteralValues_Success()

View File

@ -50,11 +50,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
"$A12345@example.com",
"!def!xyz%abc@example.com",
"_somename@example.com",
"valid.ipv4.addr@[123.1.72.10]",
"valid.ipv6.addr@[IPv6:0::1]",
"valid.ipv6.addr@[IPv6:2607:f0d0:1002:51::4]",
"valid.ipv6.addr@[IPv6:fe80::230:48ff:fe33:bc33]",
"valid.ipv6v4.addr@[IPv6:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:127.0.0.1]",
};
static readonly object[] InvalidAddresses = new object[] {
@ -69,6 +64,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
"invalid@[127.0.0.1.]",
"invalid@[127.0.0.1].",
"invalid@[127.0.0.1]x",
"valid.ipv4.addr@[123.1.72.10]",
"valid.ipv6.addr@[IPv6:0::1]",
"valid.ipv6.addr@[IPv6:2607:f0d0:1002:51::4]",
"valid.ipv6.addr@[IPv6:fe80::230:48ff:fe33:bc33]",
"valid.ipv6v4.addr@[IPv6:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:127.0.0.1]",
};
[Test]

View File

@ -90,26 +90,29 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
Assert.IsTrue (rea.IsValid (null), "Null does not match [A-Za-z].");
Assert.IsTrue (rea.IsValid ("A"), "'A' does not match [A-Za-z].");
Assert.IsTrue (rea.IsValid ("a"), "'a' does not match [A-Za-z].");
Assert.IsTrue (rea.IsValid ("Bz"), "'Bz' does not match [A-Za-z].");
Assert.IsTrue (rea.IsValid ("string"), "'string' does not match [A-Za-z].");
Assert.IsFalse (rea.IsValid (String.Empty), "Empty string matches [A-Za-z].");
Assert.IsFalse (rea.IsValid ("Bz"), "'Bz' does not match [A-Za-z].");
Assert.IsFalse (rea.IsValid ("string"), "'string' does not match [A-Za-z].");
Assert.IsTrue (rea.IsValid (String.Empty), "Empty string matches [A-Za-z].");
Assert.IsFalse (rea.IsValid ("0123456789"), "'0123456789' matches [A-Za-z].");
Assert.IsFalse (rea.IsValid ("0123456789"), "'0123456789A' matches [A-Za-z].");
AssertExtensions.Throws<InvalidCastException> (() => {
rea.IsValid (123);
}, "Casting does not fails");
AssertExtensions.Throws<InvalidCastException> (() => {
rea.IsValid (DateTime.Now);
}, "Casting does not fails");
Assert.IsFalse (rea.IsValid (123), "Casting does not fails");
Assert.IsFalse (rea.IsValid (DateTime.Now), "Casting does not fails");
rea = new RegularExpressionAttributePoker ("");
Assert.IsTrue (rea.IsValid (null), "null does not match empty pattern");
Assert.IsTrue (rea.IsValid (String.Empty), "empty string does not match empty pattern");
Assert.IsTrue (rea.IsValid ("string"), "'string' does not match empty pattern");
AssertExtensions.Throws<InvalidOperationException> (() => {
rea.IsValid (null);
}, "null does not match empty pattern");
AssertExtensions.Throws<InvalidOperationException> (() => {
rea.IsValid (String.Empty);
}, "empty string does not match empty pattern");
AssertExtensions.Throws<InvalidOperationException> (() => {
rea.IsValid ("string");
}, "'string' does not match empty pattern");
AssertExtensions.Throws<ArgumentNullException> (() => {
rea = new RegularExpressionAttributePoker (null);
}, "Null pattern allowed");
rea = new RegularExpressionAttributePoker (null);
}
}
}