You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -35,7 +35,6 @@ using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
#if NET_4_0
|
||||
[TestFixture]
|
||||
public class AssociationAttributeTest
|
||||
{
|
||||
@@ -125,5 +124,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Assert.AreEqual (String.Empty, list [0], "#C4-2");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.Reflection;
|
||||
|
||||
namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
#if NET_4_0
|
||||
public class AttributeTargetValidation
|
||||
{
|
||||
[Display(ResourceType = typeof(GoodResources), Name = "NameKey")]
|
||||
@@ -71,7 +70,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()
|
||||
@@ -274,5 +273,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Assert.Fail();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
#if NET_4_0
|
||||
[TestFixture]
|
||||
public class EnumDataTypeAttributeTest
|
||||
{
|
||||
@@ -133,5 +132,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Five = 8,
|
||||
Six = 16
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
// https://silverlight.svn.codeplex.com/svn/Release/Silverlight4/Source/RiaClient.Tests/System.ComponentModel.DataAnnotations/FilterUIHintAttributeTest.cs
|
||||
|
||||
#if NET_4_0
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
@@ -90,4 +89,3 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -104,26 +104,16 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
|
||||
Assert.IsNotNull (attr.Minimum, "#A1-1");
|
||||
Assert.IsNotNull (attr.Maximum, "#A1-2");
|
||||
#if NET_4_0
|
||||
Assert.AreEqual (typeof (string), attr.Minimum.GetType (), "#A2-1");
|
||||
Assert.AreEqual (typeof (string), attr.Maximum.GetType (), "#A2-2");
|
||||
Assert.AreEqual ("-10", attr.Minimum, "#A3-1");
|
||||
Assert.AreEqual ("10", attr.Maximum, "#A3-2");
|
||||
#else
|
||||
Assert.AreEqual (typeof (int), attr.Minimum.GetType (), "#A2-1");
|
||||
Assert.AreEqual (typeof (int), attr.Maximum.GetType (), "#A2-2");
|
||||
Assert.AreEqual (-10, attr.Minimum, "#A3-1");
|
||||
Assert.AreEqual (10, attr.Maximum, "#A3-2");
|
||||
#endif
|
||||
Assert.IsNotNull (attr.OperandType, "#A4-1");
|
||||
Assert.AreEqual (typeof (int), attr.OperandType, "#A4-2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
//LAMESPEC: documented to throw
|
||||
#if !NET_4_0
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
#endif
|
||||
public void Constructor_Type_String_String_Null_Type ()
|
||||
{
|
||||
var attr = new DA.RangeAttribute (null, "-10", "10");
|
||||
@@ -144,7 +134,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
attr.IsValid ("zero");
|
||||
}, "#A1-5");
|
||||
Assert.IsTrue (attr.IsValid (null), "#A1-6");
|
||||
#if NET_4_0
|
||||
attr = new DA.RangeAttribute (typeof (int), "minus ten", "ten");
|
||||
AssertExtensions.Throws<Exception> (() => {
|
||||
attr.IsValid ("0");
|
||||
@@ -196,31 +185,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
attr.IsValid (12);
|
||||
Assert.AreEqual (typeof (int), attr.Minimum.GetType (), "#A7-1");
|
||||
Assert.AreEqual (typeof (int), attr.Maximum.GetType (), "#A7-2");
|
||||
#else
|
||||
AssertExtensions.Throws<Exception> (() => {
|
||||
attr = new DA.RangeAttribute (typeof (int), "minus ten", "ten");
|
||||
}, "#A2");
|
||||
|
||||
AssertExtensions.Throws<ArgumentException> (() => {
|
||||
attr = new DA.RangeAttribute (typeof (RangeAttributeTest), "-10", "10");
|
||||
}, "#A3");
|
||||
|
||||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||||
attr = new DA.RangeAttribute (null, "-10", "10");
|
||||
}, "#A4");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
attr = new DA.RangeAttribute (typeof (int), null, "10");
|
||||
}, "#A5-1");
|
||||
|
||||
AssertExtensions.Throws<NotSupportedException> (() => {
|
||||
attr = new DA.RangeAttribute (typeof (int), "10", null);
|
||||
}, "#A5-2");
|
||||
|
||||
attr = new DA.RangeAttribute (typeof (int), "-10", "10");
|
||||
Assert.AreEqual (typeof (int), attr.Minimum.GetType (), "#A6-1");
|
||||
Assert.AreEqual (typeof (int), attr.Maximum.GetType (), "#A6-2");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -232,19 +196,10 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
|
||||
attr.ErrorMessage = "Param 0: {0}";
|
||||
Assert.AreEqual ("Param 0: MyField", attr.FormatErrorMessage ("MyField"), "#A2-1");
|
||||
#if !NET_4_0
|
||||
attr = new DA.RangeAttribute (-10, 10);
|
||||
#endif
|
||||
attr.ErrorMessage = "Param 0: {0}; Param 1: {1}";
|
||||
Assert.AreEqual ("Param 0: MyField; Param 1: -10", attr.FormatErrorMessage ("MyField"), "#A2-2");
|
||||
#if !NET_4_0
|
||||
attr = new DA.RangeAttribute (-10, 10);
|
||||
#endif
|
||||
attr.ErrorMessage = "Param 0: {0}; Param 1: {1}; Param 2: {2}";
|
||||
Assert.AreEqual ("Param 0: MyField; Param 1: -10; Param 2: 10", attr.FormatErrorMessage ("MyField"), "#A2-3");
|
||||
#if !NET_4_0
|
||||
attr = new DA.RangeAttribute (-10, 10);
|
||||
#endif
|
||||
attr.ErrorMessage = "Param 0: {0}; Param 1: {1}; Param 2: {2}; Param 3: {3}";
|
||||
AssertExtensions.Throws<FormatException> (() => {
|
||||
attr.FormatErrorMessage ("MyField");
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
var rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
|
||||
Assert.AreEqual (@"[A-Za-z]", rea.Pattern, "Patterns not saved correctly.");
|
||||
Assert.AreEqual (null, rea.ErrorMessage, "Error message not null when not yet matched.");
|
||||
Assert.AreEqual ("The field {0} must match the regular expression {1}.", rea.GetErrorMessageString (), "Error message not valid.");
|
||||
Assert.AreEqual ("The field {0} must match the regular expression '{1}'.", rea.GetErrorMessageString (), "Error message not valid.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -64,19 +64,13 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
var rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
|
||||
|
||||
Assert.AreEqual ("The field MyField must match the regular expression [A-Za-z].",
|
||||
Assert.AreEqual ("The field MyField must match the regular expression '[A-Za-z]'.",
|
||||
rea.FormatErrorMessage ("MyField"),
|
||||
"Error message not correctly formatted.");
|
||||
|
||||
#if !NET_4_0
|
||||
rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
|
||||
#endif
|
||||
rea.ErrorMessage = "Param 0: {0}";
|
||||
Assert.AreEqual ("Param 0: MyField", rea.FormatErrorMessage ("MyField"), "Error message not correctly updated.");
|
||||
|
||||
#if !NET_4_0
|
||||
rea = new RegularExpressionAttributePoker (@"[A-Za-z]");
|
||||
#endif
|
||||
rea.ErrorMessage = "Param 0: {0}; Param 1: {1}";
|
||||
Assert.AreEqual ("Param 0: MyField; Param 1: [A-Za-z]", rea.FormatErrorMessage ("MyField"), "Error message not correctly updated.");
|
||||
Assert.AreEqual ("Param 0: ; Param 1: [A-Za-z]", rea.FormatErrorMessage (null), "Error message fails on null value.");
|
||||
|
||||
@@ -45,12 +45,9 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Assert.IsFalse (attr.IsValid (String.Empty), "#A2");
|
||||
Assert.IsTrue (attr.IsValid ("string"), "#A3");
|
||||
Assert.IsTrue (attr.IsValid (1), "#A4");
|
||||
#if NET_4_0
|
||||
attr.AllowEmptyStrings = true;
|
||||
Assert.IsTrue (attr.IsValid (String.Empty), "#A5");
|
||||
#endif
|
||||
}
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void AllowEmptyStrings ()
|
||||
{
|
||||
@@ -60,6 +57,5 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
attr.AllowEmptyStrings = true;
|
||||
Assert.IsTrue (attr.AllowEmptyStrings, "#A2");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,16 +58,10 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Assert.AreEqual (10, sla.MaximumLength, "#A1-1");
|
||||
Assert.AreEqual (null, sla.ErrorMessage, "#A1-2");
|
||||
Assert.AreEqual ("The field {0} must be a string with a maximum length of {1}.", sla.GetErrorMessageString (), "#A1-3");
|
||||
#if NET_4_0
|
||||
Assert.AreEqual (0, sla.MinimumLength, "#A1-4");
|
||||
|
||||
sla = new StringLengthAttributePoker (-10);
|
||||
Assert.AreEqual (-10, sla.MaximumLength, "#B1");
|
||||
#else
|
||||
AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
|
||||
sla = new StringLengthAttributePoker (-10);
|
||||
}, "#B1");
|
||||
#endif
|
||||
sla = new StringLengthAttributePoker (0);
|
||||
Assert.AreEqual (0, sla.MaximumLength, "#C1");
|
||||
}
|
||||
@@ -78,14 +72,8 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
var sla = new StringLengthAttributePoker (10);
|
||||
|
||||
Assert.AreEqual ("The field MyField must be a string with a maximum length of 10.", sla.FormatErrorMessage ("MyField"), "#A1-1");
|
||||
#if !NET_4_0
|
||||
sla = new StringLengthAttributePoker (10);
|
||||
#endif
|
||||
sla.ErrorMessage = "Param 0: {0}";
|
||||
Assert.AreEqual ("Param 0: MyField", sla.FormatErrorMessage ("MyField"), "#A1-2");
|
||||
#if !NET_4_0
|
||||
sla = new StringLengthAttributePoker (10);
|
||||
#endif
|
||||
sla.ErrorMessage = "Param 0: {0}; Param 1: {1}";
|
||||
Assert.AreEqual ("Param 0: MyField; Param 1: 10", sla.FormatErrorMessage ("MyField"), "#A1-2");
|
||||
Assert.AreEqual ("Param 0: ; Param 1: 10", sla.FormatErrorMessage (null), "#A1-3");
|
||||
@@ -112,7 +100,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Assert.IsTrue (sla.IsValid (null), "#B1-1");
|
||||
Assert.IsTrue (sla.IsValid (String.Empty), "#B1-2");
|
||||
Assert.IsFalse (sla.IsValid ("string"), "#B1-3");
|
||||
#if NET_4_0
|
||||
sla = new StringLengthAttributePoker (-10);
|
||||
AssertExtensions.Throws <InvalidOperationException> (() => {
|
||||
sla.IsValid ("123");
|
||||
@@ -127,7 +114,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
sla.MinimumLength = 5;
|
||||
Assert.IsFalse (sla.IsValid ("123"), "#C2-1");
|
||||
Assert.IsTrue (sla.IsValid ("12345"), "#C2-2");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
// https://silverlight.svn.codeplex.com/svn/Release/Silverlight4/Source/RiaClient.Tests/System.ComponentModel.DataAnnotations/UIHintAttributeTest.cs
|
||||
|
||||
#if NET_4_0
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
@@ -136,4 +135,3 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -89,46 +89,11 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
|
||||
attr.ErrorMessage = "Test";
|
||||
Assert.AreEqual ("Test", attr.ErrorMessage, "#A2");
|
||||
#if NET_4_0
|
||||
attr.ErrorMessage = String.Empty;
|
||||
Assert.AreEqual (String.Empty, attr.ErrorMessage, "#A3");
|
||||
|
||||
attr.ErrorMessage = null;
|
||||
Assert.IsNull (attr.ErrorMessage, "#A4");
|
||||
#else
|
||||
try {
|
||||
attr.ErrorMessage = String.Empty;
|
||||
Assert.Fail ("#A3");
|
||||
} catch (InvalidOperationException) {
|
||||
// success
|
||||
}
|
||||
|
||||
attr = new ValidateFooAttribute ("Test");
|
||||
try {
|
||||
attr.ErrorMessage = null;
|
||||
Assert.Fail ("#A4");
|
||||
} catch (ArgumentException) {
|
||||
// success
|
||||
}
|
||||
|
||||
attr = new ValidateFooAttribute ("Test");
|
||||
try {
|
||||
attr.ErrorMessage = String.Empty;
|
||||
Assert.Fail ("#A4");
|
||||
} catch (ArgumentException) {
|
||||
// success
|
||||
}
|
||||
|
||||
attr = new ValidateFooAttribute ();
|
||||
attr.ErrorMessageResourceName = "ErrorProperty1";
|
||||
|
||||
try {
|
||||
attr.ErrorMessage = "Test Message";
|
||||
Assert.Fail ("#E1");
|
||||
} catch (InvalidOperationException) {
|
||||
// success
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -142,47 +107,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
attr.ErrorMessageResourceName = "Test";
|
||||
Assert.IsNotNull (attr.ErrorMessageResourceName, "#A2-1");
|
||||
Assert.AreEqual ("Test", attr.ErrorMessageResourceName, "#A2-2");
|
||||
#if NET_4_0
|
||||
attr.ErrorMessageResourceName = String.Empty;
|
||||
Assert.IsNotNull (attr.ErrorMessageResourceName, "#A3-1");
|
||||
Assert.AreEqual (String.Empty, attr.ErrorMessageResourceName, "#A3-2");
|
||||
|
||||
attr.ErrorMessageResourceName = null;
|
||||
Assert.IsNull (attr.ErrorMessageResourceName, "#A3-1");
|
||||
#else
|
||||
try {
|
||||
attr.ErrorMessageResourceName = String.Empty;
|
||||
Assert.Fail ("#A3-1");
|
||||
} catch (InvalidOperationException) {
|
||||
// success
|
||||
}
|
||||
|
||||
attr = new ValidateFooAttribute ("Test");
|
||||
try {
|
||||
attr.ErrorMessageResourceName = String.Empty;
|
||||
Assert.Fail ("#A3-2");
|
||||
} catch (ArgumentException) {
|
||||
// success
|
||||
}
|
||||
|
||||
attr = new ValidateFooAttribute ("Test");
|
||||
try {
|
||||
attr.ErrorMessageResourceName = null;
|
||||
Assert.Fail ("#A3-3");
|
||||
} catch (ArgumentException) {
|
||||
// success
|
||||
}
|
||||
|
||||
attr = new ValidateFooAttribute ();
|
||||
attr.ErrorMessageResourceType = typeof (FooErrorMessageProvider);
|
||||
|
||||
try {
|
||||
attr.ErrorMessageResourceName = "NoSuchProperty";
|
||||
Assert.Fail ("#A3-4");
|
||||
} catch (InvalidOperationException) {
|
||||
// success
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -195,17 +125,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
attr.ErrorMessageResourceType = typeof (FooErrorMessageProvider);
|
||||
Assert.IsNotNull (attr.ErrorMessageResourceType, "#A2-1");
|
||||
Assert.AreEqual (typeof (FooErrorMessageProvider), attr.ErrorMessageResourceType, "#A2-2");
|
||||
#if !NET_4_0
|
||||
attr = new ValidateFooAttribute ();
|
||||
attr.ErrorMessageResourceName = "NoSuchProperty";
|
||||
|
||||
try {
|
||||
attr.ErrorMessageResourceType = typeof (FooErrorMessageProvider);
|
||||
Assert.Fail ("#A3");
|
||||
} catch (InvalidOperationException) {
|
||||
// success
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -224,7 +143,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
} catch (InvalidOperationException) {
|
||||
// success
|
||||
}
|
||||
#if NET_4_0
|
||||
attr = new ValidateFooAttribute ();
|
||||
attr.ErrorMessageResourceName = String.Empty;
|
||||
try {
|
||||
@@ -324,7 +242,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
} catch (InvalidOperationException) {
|
||||
// success
|
||||
}
|
||||
#endif
|
||||
|
||||
attr = new ValidateFooAttribute ();
|
||||
attr.ErrorMessageResourceName = "ErrorProperty1";
|
||||
@@ -341,7 +258,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
attr.ErrorMessageResourceType = typeof (FooErrorMessageProvider);
|
||||
Assert.IsNotNull (attr.GetErrorMessageString (), "#D1-3");
|
||||
Assert.AreEqual ("Error Message 1", attr.GetErrorMessageString (), "#D1-4");
|
||||
#if NET_4_0
|
||||
attr.ErrorMessage = "Test Message";
|
||||
try {
|
||||
attr.GetErrorMessageString ();
|
||||
@@ -349,7 +265,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
} catch (InvalidOperationException) {
|
||||
// success
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -363,31 +278,20 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
attr.ErrorMessage = "Test: {0}";
|
||||
Assert.IsNotNull (attr.FormatErrorMessage ("SomeField"), "#A2-1");
|
||||
Assert.AreEqual ("Test: SomeField", attr.FormatErrorMessage ("SomeField"), "#A2-2");
|
||||
#if !NET_4_0
|
||||
attr = new ValidateFooAttribute ();
|
||||
#else
|
||||
attr.ErrorMessage = null;
|
||||
#endif
|
||||
attr.ErrorMessageResourceName = "ErrorProperty1";
|
||||
attr.ErrorMessageResourceType = typeof (FooErrorMessageProvider);
|
||||
Assert.IsNotNull (attr.FormatErrorMessage ("SomeField"), "#B1-1");
|
||||
Assert.AreEqual ("Error Message 1", attr.FormatErrorMessage ("SomeField"), "#B1-2");
|
||||
#if !NET_4_0
|
||||
attr = new ValidateFooAttribute ();
|
||||
#endif
|
||||
attr.ErrorMessageResourceName = "ErrorProperty6";
|
||||
attr.ErrorMessageResourceType = typeof (FooErrorMessageProvider);
|
||||
Assert.IsNotNull (attr.FormatErrorMessage ("SomeField"), "#B2-1");
|
||||
Assert.AreEqual ("Error Message 6: SomeField", attr.FormatErrorMessage ("SomeField"), "#B2-2");
|
||||
#if !NET_4_0
|
||||
attr = new ValidateFooAttribute ();
|
||||
#endif
|
||||
attr.ErrorMessageResourceName = "ErrorProperty6";
|
||||
attr.ErrorMessageResourceType = typeof (FooErrorMessageProvider);
|
||||
Assert.IsNotNull (attr.FormatErrorMessage ("SomeField"), "#B3-1");
|
||||
Assert.AreEqual ("Error Message 6: ", attr.FormatErrorMessage (null), "#B3-2");
|
||||
}
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void GetValidationResult ()
|
||||
{
|
||||
@@ -498,7 +402,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsValid_Object_ValidationContext_CrossCallsWithNIEX ()
|
||||
public void IsValid_Object_No_User_EntryPoint ()
|
||||
{
|
||||
var attr = new ValidateSomethingAttribute ();
|
||||
|
||||
@@ -515,23 +419,8 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.ValidationAttributeTest.IsValid_Object_ValidationContext_02() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\ValidationAttributeTest.cs:line 514
|
||||
attr.IsValid ("stuff");
|
||||
}, "#A1");
|
||||
|
||||
AssertExtensions.Throws<NotImplementedException> (() => {
|
||||
// And this one is thrown from the IsValid (object) overload!
|
||||
//
|
||||
// MonoTests.System.ComponentModel.DataAnnotations.ValidationAttributeTest.IsValid_Object_ValidationContext_CrossCallsWithNIEX:
|
||||
// System.NotImplementedException : IsValid(object value) has not been implemented by this class. The preferred entry point is GetValidationResult() and classes should override IsValid(object value, ValidationContext context).
|
||||
//
|
||||
// at System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(Object value)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.ValidateSomethingAttribute.IsValid(Object value, ValidationContext validationContext) in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\ValidationAttributeTest.cs:line 660
|
||||
// at System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(Object value)
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.ValidateSomethingAttribute.IsValid(Object value, ValidationContext validationContext) in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\ValidationAttributeTest.cs:line 660
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.ValidateSomethingAttribute.CallIsValid(Object value, ValidationContext validationContext) in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\ValidationAttributeTest.cs:line 667
|
||||
// at MonoTests.System.ComponentModel.DataAnnotations.ValidationAttributeTest.IsValid_Object_ValidationContext_CrossCallsWithNIEX() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\ValidationAttributeTest.cs:line 530
|
||||
|
||||
attr.CallIsValid ("stuff", null);
|
||||
}, "#A2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Validate_Object_ValidationContext ()
|
||||
{
|
||||
@@ -556,7 +445,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Assert.AreEqual ("bool IsValid (object value)", attr.Calls [1], "#A2-3");
|
||||
Assert.AreEqual ("string FormatErrorMessage (string name)", attr.Calls [2], "#A2-4");
|
||||
}
|
||||
#endif
|
||||
[Test]
|
||||
public void Validate_Object_String ()
|
||||
{
|
||||
@@ -593,12 +481,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
return ErrorMessageString;
|
||||
}
|
||||
#if !NET_4_0
|
||||
public override bool IsValid (object value)
|
||||
{
|
||||
return value != null;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
class ValidateBarAttribute : ValidateFooAttribute
|
||||
@@ -613,7 +495,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
return value != null;
|
||||
}
|
||||
#if NET_4_0
|
||||
protected override ValidationResult IsValid (object value, ValidationContext validationContext)
|
||||
{
|
||||
if (!IsValid (value))
|
||||
@@ -625,7 +506,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
return base.IsValid (value, validationContext);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
class ValidateBazAttribute : ValidateBarAttribute
|
||||
@@ -637,40 +517,22 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Calls.Add ("bool IsValid (object value)");
|
||||
return base.IsValid (value);
|
||||
}
|
||||
#if NET_4_0
|
||||
protected override ValidationResult IsValid (object value, ValidationContext validationContext)
|
||||
{
|
||||
Calls.Add ("ValidationResult IsValid (object value, ValidationContext validationContext)");
|
||||
return base.IsValid (value, validationContext);
|
||||
}
|
||||
#endif
|
||||
public override string FormatErrorMessage (string name)
|
||||
{
|
||||
Calls.Add ("string FormatErrorMessage (string name)");
|
||||
return base.FormatErrorMessage (name);
|
||||
}
|
||||
}
|
||||
#if NET_4_0
|
||||
|
||||
class ValidateSomethingAttribute : ValidationAttribute
|
||||
{
|
||||
public override bool IsValid (object value)
|
||||
{
|
||||
return base.IsValid (value, null) == ValidationResult.Success;
|
||||
}
|
||||
|
||||
protected override ValidationResult IsValid (object value, ValidationContext validationContext)
|
||||
{
|
||||
if (base.IsValid (value))
|
||||
return ValidationResult.Success;
|
||||
return new ValidationResult ("failed to validate in base class");
|
||||
}
|
||||
|
||||
public ValidationResult CallIsValid (object value, ValidationContext validationContext)
|
||||
{
|
||||
return IsValid (value, validationContext);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
class FooErrorMessageProvider
|
||||
{
|
||||
public static string ErrorProperty1
|
||||
|
||||
@@ -35,7 +35,6 @@ using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
#if NET_4_0
|
||||
[TestFixture]
|
||||
public class ValidationContextTest
|
||||
{
|
||||
@@ -238,5 +237,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
#if NET_4_0
|
||||
[TestFixture]
|
||||
public class ValidationResultTest
|
||||
{
|
||||
@@ -93,5 +92,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
Assert.IsNull (success, "#A1");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ using MonoTests.Common;
|
||||
|
||||
namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
{
|
||||
#if NET_4_0
|
||||
[TestFixture]
|
||||
public class ValidatorTest
|
||||
{
|
||||
@@ -1233,5 +1232,4 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user