diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2017-10-19 13:38:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-19 13:38:33 +0300 |
commit | 6caf00b09ca862bdd88252cc77d827000f2d58ba (patch) | |
tree | 2f467e59b17444b106871e227e0680aa4c50f8ae /mcs | |
parent | cfedbd7aa2fdb93e42e88cc488bd436942ef8e3e (diff) |
[bcl] Remove AssertExtensions helper classes (#5828)
* [bcl] Remove AssertExtensions helper classes
Since we're on nunitlite now we can use the proper `Assert.Throws<>()`
instead and remove the helper class (which we actually duplicated!)
Diffstat (limited to 'mcs')
66 files changed, 401 insertions, 695 deletions
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations_test.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations_test.dll.sources index 70011cc02ec..9454422b250 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations_test.dll.sources +++ b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations_test.dll.sources @@ -1,4 +1,3 @@ -../../System.Web.DynamicData/Test/Common/AssertExtensions.cs System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptionProviderTests.cs System.ComponentModel.DataAnnotations/AssociationAttributeTest.cs System.ComponentModel.DataAnnotations/CustomValidationAttributeTest.cs diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CompareAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CompareAttributeTest.cs index d98c051699e..6a59aaf6e86 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CompareAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CompareAttributeTest.cs @@ -32,7 +32,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs index 00cc74573f4..828b089907a 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs @@ -32,7 +32,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CustomValidationAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CustomValidationAttributeTest.cs index 2cef47f844b..f012fd289ea 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CustomValidationAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CustomValidationAttributeTest.cs @@ -30,7 +30,6 @@ using System.ComponentModel.Design; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { @@ -86,7 +85,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations var attr = new CustomValidationAttribute (null, null); string msg = null; - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The CustomValidationAttribute.ValidatorType was not specified. // @@ -98,7 +97,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }, "#A1"); attr = new CustomValidationAttribute (typeof (string), null); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The CustomValidationAttribute.Method was not specified. // @@ -110,7 +109,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }, "#A2"); attr = new CustomValidationAttribute (typeof (string), String.Empty); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The CustomValidationAttribute.Method was not specified. // @@ -122,7 +121,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }, "#A3"); attr = new CustomValidationAttribute (typeof (string), "NoSuchMethod"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The CustomValidationAttribute method 'NoSuchMethod' does not exist in type 'String' or is not public and static. // @@ -134,7 +133,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }, "#A4"); attr = new CustomValidationAttribute (typeof (PrivateValidatorMethodContainer), "MethodOne"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The custom validation type 'PrivateValidatorMethodContainer' must be public. // @@ -146,7 +145,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }, "#A5"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodOne"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The CustomValidationAttribute method 'MethodOne' in type 'PublicValidatorMethodContainer' // must return System.ComponentModel.DataAnnotations.ValidationResult. Use System.ComponentModel.DataAnnotations.ValidationResult.Success @@ -159,7 +158,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }, "#A6"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodTwo"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The CustomValidationAttribute method 'MethodTwo' in type 'PublicValidatorMethodContainer' must match the expected signature: public static ValidationResult MethodTwo(object value, ValidationContext context). The value can be strongly typed. The ValidationContext parameter is optional. // @@ -182,7 +181,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.AreEqual ("test is not valid.", msg, "#A9-3"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodFive"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The CustomValidationAttribute method 'MethodFive' in type 'PublicValidatorMethodContainer' must match the expected signature: public static ValidationResult MethodFive(object value, ValidationContext context). The value can be strongly typed. The ValidationContext parameter is optional. // @@ -193,7 +192,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }, "#A10"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodSix"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.CustomValidationAttributeTest.FormatErrorMessage: // System.InvalidOperationException : The CustomValidationAttribute method 'MethodSix' in type 'PublicValidatorMethodContainer' must match the expected signature: public static ValidationResult MethodSix(object value, ValidationContext context). The value can be strongly typed. The ValidationContext parameter is optional. // @@ -209,37 +208,37 @@ namespace MonoTests.System.ComponentModel.DataAnnotations { var attr = new CustomValidationAttribute (null, null); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A1"); attr = new CustomValidationAttribute (typeof (string), null); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A2"); attr = new CustomValidationAttribute (typeof (string), String.Empty); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A3"); attr = new CustomValidationAttribute (typeof (string), "NoSuchMethod"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A4"); attr = new CustomValidationAttribute (typeof (PrivateValidatorMethodContainer), "MethodOne"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A5"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodOne"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A6"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodTwo"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A7"); @@ -260,17 +259,17 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.IsFalse (valid, "#A9-3"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodFive"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A10"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodSix"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid ("test"); }, "#A11"); attr = new CustomValidationAttribute (typeof (PublicValidatorMethodContainer), "MethodSeven"); - AssertExtensions.Throws<ApplicationException> (() => { + Assert.Throws<ApplicationException> (() => { attr.IsValid ("test"); }, "#A12"); } diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs index f85887cef65..e812389d2c5 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs @@ -32,7 +32,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/FileExtensionsAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/FileExtensionsAttributeTest.cs index 6ef0263365c..f7a93a58979 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/FileExtensionsAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/FileExtensionsAttributeTest.cs @@ -32,7 +32,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/PhoneAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/PhoneAttributeTest.cs index ef9c95dfb75..cac863fe637 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/PhoneAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/PhoneAttributeTest.cs @@ -32,7 +32,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RangeAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RangeAttributeTest.cs index 1f297263792..d16174fd892 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RangeAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RangeAttributeTest.cs @@ -31,7 +31,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; using DA = global::System.ComponentModel.DataAnnotations; @@ -130,49 +129,49 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.IsFalse (attr.IsValid ("12"), "#A1-2"); Assert.IsTrue (attr.IsValid (null), "#A1-3"); Assert.IsTrue (attr.IsValid (String.Empty), "#A1-4"); - AssertExtensions.Throws <Exception> (() => { + Assert.Throws <Exception> (() => { attr.IsValid ("zero"); }, "#A1-5"); Assert.IsTrue (attr.IsValid (null), "#A1-6"); attr = new DA.RangeAttribute (typeof (int), "minus ten", "ten"); - AssertExtensions.Throws<Exception> (() => { + Assert.Throws<Exception> (() => { attr.IsValid ("0"); }, "#A2-1"); - AssertExtensions.Throws<Exception> (() => { + Assert.Throws<Exception> (() => { attr.IsValid ("12"); }, "#A2-2"); - AssertExtensions.Throws<Exception> (() => { + Assert.Throws<Exception> (() => { attr.IsValid ("zero"); }, "#A2-3"); attr = new DA.RangeAttribute (typeof (RangeAttributeTest), "-10", "10"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid (null); }, "#A3-1"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { attr.IsValid (String.Empty); }, "#A3-2"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // The type MonoTests.System.ComponentModel.DataAnnotations.RangeAttributeTest must implement System.IComparable. attr.IsValid ("10"); }, "#A3-3"); attr = new DA.RangeAttribute (null, "-10", "10"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // The OperandType must be set when strings are used for minimum and maximum values. attr.IsValid ("10"); }, "#A4"); attr = new DA.RangeAttribute (typeof (int), null, "10"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // The minimum and maximum values must be set. attr.IsValid (10); }, "#A5-1"); attr = new DA.RangeAttribute (typeof (int), "10", null); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // The minimum and maximum values must be set. attr.IsValid (10); }, "#A5-2"); @@ -201,7 +200,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations 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"); attr.ErrorMessage = "Param 0: {0}; Param 1: {1}; Param 2: {2}; Param 3: {3}"; - AssertExtensions.Throws<FormatException> (() => { + Assert.Throws<FormatException> (() => { attr.FormatErrorMessage ("MyField"); }, "#A2-1"); } diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs index bb9852e1fc9..63971b66d22 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs @@ -31,7 +31,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { @@ -94,15 +93,15 @@ namespace MonoTests.System.ComponentModel.DataAnnotations rea = new RegularExpressionAttributePoker (""); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { rea.IsValid (null); }, "null does not match empty pattern"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { rea.IsValid (String.Empty); }, "empty string does not match empty pattern"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { rea.IsValid ("string"); }, "'string' does not match empty pattern"); diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/StringLengthAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/StringLengthAttributeTest.cs index 61b61683e69..e6daa9d4e41 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/StringLengthAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/StringLengthAttributeTest.cs @@ -31,7 +31,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { @@ -89,10 +88,10 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.IsTrue (sla.IsValid ("string"), "#A1-3"); Assert.IsTrue (sla.IsValid ("0123456789"), "#A1-4"); Assert.IsFalse (sla.IsValid ("0123456789A"), "#A1-5"); - AssertExtensions.Throws<InvalidCastException> (() => { + Assert.Throws<InvalidCastException> (() => { sla.IsValid (123); }, "#A1-6"); - AssertExtensions.Throws<InvalidCastException> (() => { + Assert.Throws<InvalidCastException> (() => { sla.IsValid (DateTime.Now); }, "#A1-7"); @@ -101,13 +100,13 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.IsTrue (sla.IsValid (String.Empty), "#B1-2"); Assert.IsFalse (sla.IsValid ("string"), "#B1-3"); sla = new StringLengthAttributePoker (-10); - AssertExtensions.Throws <InvalidOperationException> (() => { + Assert.Throws <InvalidOperationException> (() => { sla.IsValid ("123"); }, "#C1-1"); sla = new StringLengthAttributePoker (10); sla.MinimumLength = 20; - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { sla.IsValid ("123"); }, "#C1-2"); diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/ValidationAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/ValidationAttributeTest.cs index 0d8bdc4e4ab..712d37185e3 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/ValidationAttributeTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/ValidationAttributeTest.cs @@ -31,7 +31,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { @@ -351,7 +350,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations { var attr = new ValidateFooAttribute (); - AssertExtensions.Throws <NotImplementedException> (() => { + Assert.Throws <NotImplementedException> (() => { // It calls IsValid (object, validationContext) which throws the NIEX, but when that overload is called directly, there's // no exception. // @@ -361,7 +360,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations attr.IsValid (null); }, "#A1-1"); - AssertExtensions.Throws <NotImplementedException> (() => { + Assert.Throws <NotImplementedException> (() => { attr.IsValid ("stuff"); }, "#A1-2"); } @@ -371,7 +370,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations { var attr = new ValidateBarAttribute (); - AssertExtensions.Throws <NullReferenceException> (() => { + Assert.Throws <NullReferenceException> (() => { attr.CallIsValid (null, null); }, "#A1"); @@ -406,7 +405,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations { var attr = new ValidateSomethingAttribute (); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { // Thrown from the IsValid (object, ValidationContext) overload! // // MonoTests.System.ComponentModel.DataAnnotations.ValidationAttributeTest.IsValid_Object_ValidationContext_02: diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/ValidatorTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/ValidatorTest.cs index abb1e9f5156..f950b6a2773 100644 --- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/ValidatorTest.cs +++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/ValidatorTest.cs @@ -29,7 +29,6 @@ using System.ComponentModel.DataAnnotations; using System.Text; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.ComponentModel.DataAnnotations { @@ -43,11 +42,11 @@ namespace MonoTests.System.ComponentModel.DataAnnotations var ctx = new ValidationContext (dummy, null, null); var results = new List<ValidationResult> (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateObject (null, ctx, results); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateObject (dummy, null, results); }, "#A1-2"); @@ -70,7 +69,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations dummy = new Dummy { NameField = null }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { // The instance provided must match the ObjectInstance on the ValidationContext supplied. valid = Validator.TryValidateObject (dummy, ctx, results); }, "#A2"); @@ -133,11 +132,11 @@ namespace MonoTests.System.ComponentModel.DataAnnotations var ctx = new ValidationContext (dummy, null, null); var results = new List<ValidationResult> (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateObject (null, ctx, results, false); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateObject (dummy, null, results, false); }, "#A1-2"); @@ -168,12 +167,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations dummy = new Dummy { NameField = null }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { // The instance provided must match the ObjectInstance on the ValidationContext supplied. valid = Validator.TryValidateObject (dummy, ctx, results, false); }, "#A2-1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { // The instance provided must match the ObjectInstance on the ValidationContext supplied. valid = Validator.TryValidateObject (dummy, ctx, results, true); }, "#A2-2"); @@ -269,7 +268,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations var dummy2 = new DummyWithException (); ctx = new ValidationContext (dummy2, null, null); - AssertExtensions.Throws<ApplicationException> (() => { + Assert.Throws<ApplicationException> (() => { Validator.TryValidateObject (dummy2, ctx, results, true); }, "#A9"); } @@ -283,7 +282,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }; var results = new List<ValidationResult> (); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.ValidatorTest.TryValidateProperty: // System.ArgumentException : The type 'DummyNoAttributes' does not contain a public property named 'NameProperty'. // Parameter name: propertyName @@ -297,7 +296,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations }, "#A1-1"); Assert.AreEqual (0, results.Count, "#A1-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateProperty ("dummy", null, results); }, "#A1-2"); @@ -314,12 +313,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = "MinMaxProperty" }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { Validator.TryValidateProperty (null, ctx, results); }, "#A1-5"); ctx = new ValidationContext (dummy2, null, null); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.ValidatorTest.TryValidateProperty: // System.ArgumentNullException : Value cannot be null. // Parameter name: propertyName @@ -338,7 +337,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = String.Empty }; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.ValidatorTest.TryValidateProperty: // System.ArgumentNullException : Value cannot be null. // Parameter name: propertyName @@ -358,7 +357,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = "NameProperty" }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { // MonoTests.System.ComponentModel.DataAnnotations.ValidatorTest.TryValidateProperty: // System.ArgumentException : The value for property 'NameProperty' must be of type 'System.String'. // Parameter name: value @@ -429,7 +428,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.IsTrue (valid, "#A1-1"); Assert.AreEqual (0, results.Count, "#A1-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateValue ("dummy", null, results, attributes); }, "#A2"); @@ -437,7 +436,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.IsTrue (valid, "#A3-1"); Assert.AreEqual (0, results.Count, "#A3-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateValue ("dummy", ctx, results, null); }, "#A4"); } @@ -464,7 +463,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations results.Clear (); log.Clear (); - AssertExtensions.Throws<InvalidCastException> (() => { + Assert.Throws<InvalidCastException> (() => { // Thrown by StringValidatorAttribute Validator.TryValidateValue (1234, ctx, results, attributes); }, "#A2-1"); @@ -490,7 +489,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations attributes.RemoveAt (2); attributes.RemoveAt (2); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateValue ("dummy", null, results, attributes); }, "#B1"); @@ -498,7 +497,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.IsTrue (valid, "#B2-1"); Assert.AreEqual (0, results.Count, "#B2-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.TryValidateValue ("dummy", ctx, results, null); }, "#B3"); } @@ -509,11 +508,11 @@ namespace MonoTests.System.ComponentModel.DataAnnotations var dummy = new DummyNoAttributes (); var ctx = new ValidationContext (dummy, null, null); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateObject (null, ctx); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateObject (dummy, null); }, "#A1-2"); @@ -539,7 +538,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations dummy = new Dummy { NameField = null }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { // The instance provided must match the ObjectInstance on the ValidationContext supplied. Validator.ValidateObject (dummy, ctx); }, "#A2"); @@ -566,7 +565,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations RequiredDummyProperty = null }; ctx = new ValidationContext (dummy, null, null); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx); }, "#A5"); @@ -595,7 +594,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations FailValidation = true }; ctx = new ValidationContext (dummy, null, null); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx); }, "#A8"); @@ -614,11 +613,11 @@ namespace MonoTests.System.ComponentModel.DataAnnotations var dummy = new DummyNoAttributes (); var ctx = new ValidationContext (dummy, null, null); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateObject (null, ctx, false); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateObject (dummy, null, false); }, "#A1-2"); @@ -656,12 +655,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations dummy = new Dummy { NameField = null }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { // The instance provided must match the ObjectInstance on the ValidationContext supplied. Validator.ValidateObject (dummy, ctx, false); }, "#A3-1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { // The instance provided must match the ObjectInstance on the ValidationContext supplied. Validator.ValidateObject (dummy, ctx, true); }, "#A3-2"); @@ -701,11 +700,11 @@ namespace MonoTests.System.ComponentModel.DataAnnotations RequiredDummyProperty = null }; ctx = new ValidationContext (dummy, null, null); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx, false); }, "#A6-1"); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx, true); }, "#A6-2"); @@ -727,12 +726,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations } dummy.NameProperty = "0"; - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx, true); }, "#A9"); dummy.NameProperty = "name too long (invalid value)"; - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx, true); }, "#A10"); @@ -746,7 +745,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.Fail ("#A11 (exception {0} thrown: {1})", ex.GetType (), ex.Message); } - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx, true); }, "#A12"); @@ -754,17 +753,17 @@ namespace MonoTests.System.ComponentModel.DataAnnotations FailValidation = true }; ctx = new ValidationContext (dummy, null, null); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx, false); }, "#A13-1"); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateObject (dummy, ctx, true); }, "#A13-2"); var dummy2 = new DummyWithException (); ctx = new ValidationContext (dummy2, null, null); - AssertExtensions.Throws<ApplicationException> (() => { + Assert.Throws<ApplicationException> (() => { Validator.ValidateObject (dummy2, ctx, true); }, "#A14"); @@ -793,11 +792,11 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = "NameProperty" }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { Validator.ValidateProperty ("dummy", ctx); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateProperty ("dummy", null); }, "#A1-2"); @@ -816,12 +815,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = "MinMaxProperty" }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { Validator.ValidateProperty (null, ctx); }, "#A3"); ctx = new ValidationContext (dummy2, null, null); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateProperty ("dummy", ctx); }, "#A4"); @@ -829,7 +828,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = String.Empty }; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateProperty ("dummy", ctx); }, "#A5"); @@ -838,7 +837,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = "NameProperty" }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { Validator.ValidateProperty (1234, ctx); }, "#A6"); @@ -847,11 +846,11 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = "NameProperty" }; - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateProperty (String.Empty, ctx); }, "#A7"); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateProperty ("this value is way too long", ctx); }, "#A8"); @@ -866,15 +865,15 @@ namespace MonoTests.System.ComponentModel.DataAnnotations MemberName = "CustomValidatedProperty" }; - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateProperty (String.Empty, ctx); }, "#A10"); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateProperty ("fail", ctx); }, "#A11"); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateProperty ("f", ctx); }, "#A12"); @@ -900,7 +899,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.Fail ("#A1 (exception {0} thrown: {1})", ex.GetType (), ex.Message); } - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateValue ("dummy", null, attributes); }, "#A2"); @@ -910,7 +909,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.Fail ("#A3 (exception {0} thrown: {1})", ex.GetType (), ex.Message); } - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateValue ("dummy", ctx, null); }, "#A4"); } @@ -928,14 +927,14 @@ namespace MonoTests.System.ComponentModel.DataAnnotations new RequiredAttributePoker (log) }; - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateValue (null, ctx, attributes); }, "#A1-1"); Assert.AreEqual (1, log.Count, "#A1-2"); Assert.IsTrue (log[0].StartsWith ("RequiredAttributePoker.IsValid (object)"), "#A1-3"); log.Clear (); - AssertExtensions.Throws<InvalidCastException> (() => { + Assert.Throws<InvalidCastException> (() => { // Thrown by StringValidatorAttribute Validator.ValidateValue (1234, ctx, attributes); }, "#A2-1");; @@ -946,7 +945,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations attributes.Add (new CustomValidationAttribute (typeof (ValidatorTest), "ValueValidationMethod")); attributes.Add (new CustomValidationAttribute (typeof (ValidatorTest), "ValueValidationMethod")); - AssertExtensions.Throws<ValidationException> (() => { + Assert.Throws<ValidationException> (() => { Validator.ValidateValue ("test", ctx, attributes); }, "#A3-1"); Assert.AreEqual (2, log.Count, "#A3-2"); @@ -956,7 +955,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations attributes.RemoveAt (2); attributes.RemoveAt (2); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateValue ("dummy", null, attributes); }, "#B1"); @@ -966,7 +965,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations Assert.Fail ("#B2 (exception {0} thrown: {1})", ex.GetType (), ex.Message); } - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { Validator.ValidateValue ("dummy", ctx, null); }, "#B3"); } diff --git a/mcs/class/System.Data.Services/System.Data.Services_test.dll.sources b/mcs/class/System.Data.Services/System.Data.Services_test.dll.sources index b97d3ee88ae..438c8ac97d4 100644 --- a/mcs/class/System.Data.Services/System.Data.Services_test.dll.sources +++ b/mcs/class/System.Data.Services/System.Data.Services_test.dll.sources @@ -1,5 +1,3 @@ -../../System.Web.DynamicData/Test/Common/AssertExtensions.cs - ./IgnorePropertiesAttributeTests.cs ./QueryInterceptorAttributeTests.cs ./DataServiceTests.cs diff --git a/mcs/class/System.Data.Services/Test/System.Data.Services.Providers/DataServiceProviderMethodsTest.cs b/mcs/class/System.Data.Services/Test/System.Data.Services.Providers/DataServiceProviderMethodsTest.cs index 33bf1f4aba1..d88582cf00a 100644 --- a/mcs/class/System.Data.Services/Test/System.Data.Services.Providers/DataServiceProviderMethodsTest.cs +++ b/mcs/class/System.Data.Services/Test/System.Data.Services.Providers/DataServiceProviderMethodsTest.cs @@ -29,7 +29,6 @@ using System.Collections.Generic; using System.Data.Services.Providers; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Data.Services.Providers { @@ -40,11 +39,11 @@ namespace MonoTests.System.Data.Services.Providers public void TypeIs () { var rt = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, null, "System", "String", false); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { DataServiceProviderMethods.TypeIs ("test", rt); }, "#A1"); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { DataServiceProviderMethods.TypeIs (null, null); }, "#A2"); } @@ -53,11 +52,11 @@ namespace MonoTests.System.Data.Services.Providers public void Convert () { var rt = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, null, "System", "String", false); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { DataServiceProviderMethods.Convert ("test", rt); }, "#A1"); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { DataServiceProviderMethods.Convert (null, null); }, "#A2"); } @@ -67,11 +66,11 @@ namespace MonoTests.System.Data.Services.Providers { var rt = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, null, "System", "String", false); var rp = new ResourceProperty ("Length", ResourcePropertyKind.ComplexType, rt); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { DataServiceProviderMethods.GetSequenceValue<string> ("test", rp); }, "#A1"); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { DataServiceProviderMethods.GetSequenceValue<string> (null, null); }, "#A2"); } @@ -81,11 +80,11 @@ namespace MonoTests.System.Data.Services.Providers { var rt = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, null, "System", "String", false); var rp = new ResourceProperty ("Length", ResourcePropertyKind.ComplexType, rt); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { DataServiceProviderMethods.GetValue ("test", rp); }, "#A1"); - AssertExtensions.Throws<NotImplementedException> (() => { + Assert.Throws<NotImplementedException> (() => { DataServiceProviderMethods.GetValue (null, null); }, "#A2"); } diff --git a/mcs/class/System.Data.Services/Test/System.Data.Services.Providers/ResourceTypeTest.cs b/mcs/class/System.Data.Services/Test/System.Data.Services.Providers/ResourceTypeTest.cs index d38633c5bc9..4cc530a9f70 100644 --- a/mcs/class/System.Data.Services/Test/System.Data.Services.Providers/ResourceTypeTest.cs +++ b/mcs/class/System.Data.Services/Test/System.Data.Services.Providers/ResourceTypeTest.cs @@ -29,7 +29,6 @@ using System.Collections.Generic; using System.Data.Services.Providers; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Data.Services.Providers { @@ -42,31 +41,31 @@ namespace MonoTests.System.Data.Services.Providers var dummy = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, null, "System", "String", false); ResourceType rt; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { rt = new ResourceType (null, ResourceTypeKind.ComplexType, dummy, "System", "Null", false); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { rt = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, dummy, "System", null, false); }, "#A1-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { rt = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, dummy, null, null, false); }, "#A1-3"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { rt = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, dummy, "System", String.Empty, false); }, "#A1-4"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { rt = new ResourceType (typeof (string), ResourceTypeKind.Primitive, null, "System", "String", false); }, "#A2-1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { rt = new ResourceType (typeof (bool), ResourceTypeKind.Primitive, null, "System", "Bool", false); }, "#A2-2"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { rt = new ResourceType (typeof (int), ResourceTypeKind.EntityType, null, "System", "Int32", true); }, "#A2-3"); diff --git a/mcs/class/System.Runtime.Caching/System.Runtime.Caching_test.dll.sources b/mcs/class/System.Runtime.Caching/System.Runtime.Caching_test.dll.sources index 10ae0eea2cf..1b0c7d1e510 100644 --- a/mcs/class/System.Runtime.Caching/System.Runtime.Caching_test.dll.sources +++ b/mcs/class/System.Runtime.Caching/System.Runtime.Caching_test.dll.sources @@ -1,5 +1,4 @@ Common/AppDomainTools.cs -Common/AssertExtensions.cs Common/PokerChangeMonitor.cs Common/PokerMemoryCache.cs Common/PokerObjectCache.cs diff --git a/mcs/class/System.Runtime.Caching/Test/Common/AssertExtensions.cs b/mcs/class/System.Runtime.Caching/Test/Common/AssertExtensions.cs deleted file mode 100644 index 41e340bfd35..00000000000 --- a/mcs/class/System.Runtime.Caching/Test/Common/AssertExtensions.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; - -using NUnit.Framework; - -namespace MonoTests.Common -{ - delegate void AssertThrowsDelegate(); - - static class AssertExtensions - { - public static void AreEqual (byte[] expected, byte[] data, string message) - { - if (expected == null) { - if (data == null) - return; - Assert.Fail ("{0}{1}Expected: null{1}Got: byte array with {2} elements and of rank {3}{1}", - message, Environment.NewLine, data.Length, data.Rank); - } - - if (data == null) - Assert.Fail ("{0}{1}Expected: byte array with {2} elements and rank {3}{1}Got: null{1}", - message, Environment.NewLine, expected.Length, expected.Rank); - - if (expected.Rank > 1) - Assert.Fail ("Only single-dimensional arrays are supported."); - - if (expected.Rank != data.Rank || expected.Length != data.Length) - Assert.Fail ("{0}{1}Expected: byte array with {2} elements and rank {3}{1}Got: byte array with {4} elements and rank {5}{1}", - message, Environment.NewLine, expected.Length, expected.Rank, data.Length, data.Rank); - - int max = expected.Length; - for (int i = 0; i < max; i++) { - if (expected[i] != data[i]) - Assert.Fail ("{0}{1}Arrays differ at index {2}.{1}Expected 0x{3:X} got 0x{4:X}{1}", - message, Environment.NewLine, i, expected[i], data[i]); - } - } - - public static void Throws<ET> (AssertThrowsDelegate code, string message) - { - Throws(typeof(ET), code, message); - } - - public static void Throws(Type exceptionType, AssertThrowsDelegate code, string message) - { - if (code == null) - Assert.Fail("No code provided for the test."); - - Exception exception = null; - try - { - code(); - } - catch (Exception ex) - { - exception = ex; - } - - if (exceptionType == null) - { - if (exception == null) - Assert.Fail("{0}{1}Expected: any exception thrown{1}But was: no exception thrown{1}", - message, Environment.NewLine); - return; - } - - if (exception == null || exception.GetType() != exceptionType) - Assert.Fail("{0}{1}Expected: {2}{1}But was: {3}{1}{4}{1}", - message, - Environment.NewLine, - exceptionType, - exception == null ? "no exception" : exception.GetType().ToString(), - exception == null ? "no exception" : exception.ToString()); - } - - public static void Throws(AssertThrowsDelegate code, string message) - { - Throws(null, code, message); - } - } -} diff --git a/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/HostFileChangeMonitorTest.cs b/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/HostFileChangeMonitorTest.cs index 9255033ef76..61324b773e0 100644 --- a/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/HostFileChangeMonitorTest.cs +++ b/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/HostFileChangeMonitorTest.cs @@ -50,28 +50,28 @@ namespace MonoTests.System.Runtime.Caching relPath }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { monitor = new HostFileChangeMonitor (paths); }, "#A1"); paths.Clear (); paths.Add (null); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { monitor = new HostFileChangeMonitor (paths); }, "#A2"); paths.Clear (); paths.Add (String.Empty); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { monitor = new HostFileChangeMonitor (paths); }, "#A3"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { monitor = new HostFileChangeMonitor (null); }, "#A4"); paths.Clear (); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { monitor = new HostFileChangeMonitor (paths); }, "#A5"); } @@ -109,7 +109,7 @@ namespace MonoTests.System.Runtime.Caching // at System.Runtime.Caching.HostFileChangeMonitor.InitDisposableMembers() // at System.Runtime.Caching.HostFileChangeMonitor..ctor(IList`1 filePaths) // at MonoTests.System.Runtime.Caching.HostFileChangeMonitorTest.Constructor_MissingFiles() in c:\users\grendel\documents\visual studio 2010\Projects\System.Runtime.Caching.Test\System.Runtime.Caching.Test\System.Runtime.Caching\HostFileChangeMonitorTest.cs:line 68 - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { monitor = new HostFileChangeMonitor (paths); }, "#A1"); diff --git a/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs b/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs index 7e0c8dc47c5..34b3957df71 100644 --- a/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs +++ b/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs @@ -45,69 +45,69 @@ namespace MonoTests.System.Runtime.Caching public void ConstructorParameters () { MemoryCache mc; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc = new MemoryCache (null); }, "#A1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache (String.Empty); }, "#A2"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("default"); }, "#A3"); var config = new NameValueCollection (); config.Add ("CacheMemoryLimitMegabytes", "invalid"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-1"); config.Clear (); config.Add ("PhysicalMemoryLimitPercentage", "invalid"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-2"); config.Clear (); config.Add ("PollingInterval", "invalid"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-3"); config.Clear (); config.Add ("CacheMemoryLimitMegabytes", "-1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-4"); config.Clear (); config.Add ("CacheMemoryLimitMegabytes", UInt64.MaxValue.ToString ()); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-5"); config.Clear (); config.Add ("PhysicalMemoryLimitPercentage", "-1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-6"); config.Clear (); config.Add ("PhysicalMemoryLimitPercentage", UInt64.MaxValue.ToString ()); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-7"); config.Clear (); config.Add ("PhysicalMemoryLimitPercentage", UInt32.MaxValue.ToString ()); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-8"); config.Clear (); config.Add ("PhysicalMemoryLimitPercentage", "-10"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-9"); @@ -118,7 +118,7 @@ namespace MonoTests.System.Runtime.Caching config.Clear (); config.Add ("PhysicalMemoryLimitPercentage", "101"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc = new MemoryCache ("MyCache", config); }, "#A4-10"); @@ -191,15 +191,15 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc [null] = "value"; }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { object v = mc [null]; }, "#A1-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc ["key"] = null; }, "#A1-3"); @@ -223,11 +223,11 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Contains (null); }, "#A1-1"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.Contains ("key", "region"); }, "#A1-2"); @@ -249,19 +249,19 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.CreateCacheEntryChangeMonitor (new string [] { "key" }, "region"); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.CreateCacheEntryChangeMonitor (null); }, "#A1-2"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc.CreateCacheEntryChangeMonitor (new string [] {}); }, "#A1-3"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc.CreateCacheEntryChangeMonitor (new string [] { "key", null }); }, "#A1-4"); @@ -316,15 +316,15 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.AddOrGetExisting (null, "value", DateTimeOffset.Now); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.AddOrGetExisting ("key", null, DateTimeOffset.Now); }, "#A1-2"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.AddOrGetExisting ("key", "value", DateTimeOffset.Now, "region"); }, "#A1-3"); @@ -350,11 +350,11 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.AddOrGetExisting (null, "value", null); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.AddOrGetExisting ("key", null, null); }, "#A1-2"); @@ -362,29 +362,29 @@ namespace MonoTests.System.Runtime.Caching cip.AbsoluteExpiration = DateTime.Now.AddMinutes (1); cip.SlidingExpiration = TimeSpan.FromMinutes (1); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc.AddOrGetExisting ("key", "value", cip); }, "#A1-3"); cip = new CacheItemPolicy (); cip.SlidingExpiration = TimeSpan.MinValue; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.AddOrGetExisting ("key3", "value", cip); }, "#A1-4"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.AddOrGetExisting ("key", "value", null, "region"); }, "#A1-5"); cip = new CacheItemPolicy (); cip.SlidingExpiration = TimeSpan.FromDays (500); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.AddOrGetExisting ("key3", "value", cip); }, "#A1-6"); cip = new CacheItemPolicy (); cip.Priority = (CacheItemPriority) 20; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.AddOrGetExisting ("key3", "value", cip); }, "#A1-7"); @@ -425,7 +425,7 @@ namespace MonoTests.System.Runtime.Caching var mc = new PokerMemoryCache ("MyCache"); CacheItem ci, ci2; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { ci = mc.AddOrGetExisting (null, new CacheItemPolicy ()); }, "#A1"); @@ -448,7 +448,7 @@ namespace MonoTests.System.Runtime.Caching Assert.AreEqual (ci.Value, ci2.Value, "#A3-4"); Assert.AreEqual (ci.Key, ci2.Key, "#A3-5"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { ci = new CacheItem (null, "value"); ci2 = mc.AddOrGetExisting (ci, null); }, "#A4"); @@ -468,14 +468,14 @@ namespace MonoTests.System.Runtime.Caching // at System.Runtime.Caching.MemoryCache.AddOrGetExistingInternal(String key, Object value, CacheItemPolicy policy) // at System.Runtime.Caching.MemoryCache.AddOrGetExisting(CacheItem item, CacheItemPolicy policy) // at MonoTests.System.Runtime.Caching.MemoryCacheTest.AddOrGetExisting_CacheItem_CacheItemPolicy() in C:\Users\grendel\documents\visual studio 2010\Projects\System.Runtime.Caching.Test\System.Runtime.Caching.Test\System.Runtime.Caching\MemoryCacheTest.cs:line 211 - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { ci2 = mc.AddOrGetExisting (ci, null); }, "#B1"); ci = new CacheItem ("key3", "value"); var cip = new CacheItemPolicy (); cip.UpdateCallback = (CacheEntryUpdateArguments arguments) => { }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { ci2 = mc.AddOrGetExisting (ci, cip); }, "#B2"); @@ -483,14 +483,14 @@ namespace MonoTests.System.Runtime.Caching cip = new CacheItemPolicy (); cip.AbsoluteExpiration = DateTimeOffset.Now; cip.SlidingExpiration = TimeSpan.FromTicks (DateTime.Now.Ticks); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc.AddOrGetExisting (ci, cip); }, "#B3"); ci = new CacheItem ("key3", "value"); cip = new CacheItemPolicy (); cip.SlidingExpiration = TimeSpan.MinValue; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.AddOrGetExisting (ci, cip); }, "#B4-1"); @@ -503,7 +503,7 @@ namespace MonoTests.System.Runtime.Caching ci = new CacheItem ("key3", "value"); cip = new CacheItemPolicy (); cip.SlidingExpiration = TimeSpan.FromDays (500); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.AddOrGetExisting (ci, cip); }, "#B5-1"); @@ -516,7 +516,7 @@ namespace MonoTests.System.Runtime.Caching ci = new CacheItem ("key3", "value"); cip = new CacheItemPolicy (); cip.Priority = (CacheItemPriority)20; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.AddOrGetExisting (ci, cip); }, "#B6"); @@ -559,28 +559,28 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.Set ("key", "value", new CacheItemPolicy (), "region"); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Set (null, "value", new CacheItemPolicy ()); }, "#A1-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Set ("key", null, new CacheItemPolicy ()); }, "#A1-3"); var cip = new CacheItemPolicy (); cip.UpdateCallback = (CacheEntryUpdateArguments arguments) => { }; cip.RemovedCallback = (CacheEntryRemovedArguments arguments) => { }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc.Set ("key", "value", cip); }, "#A1-4"); cip = new CacheItemPolicy (); cip.SlidingExpiration = TimeSpan.MinValue; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.Set ("key", "value", cip); }, "#A1-5"); @@ -591,7 +591,7 @@ namespace MonoTests.System.Runtime.Caching cip = new CacheItemPolicy (); cip.SlidingExpiration = TimeSpan.FromDays (500); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.Set ("key", "value", cip); }, "#A1-7"); @@ -602,7 +602,7 @@ namespace MonoTests.System.Runtime.Caching cip = new CacheItemPolicy (); cip.Priority = (CacheItemPriority) 20; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.Set ("key", "value", cip); }, "#A1-9"); @@ -635,15 +635,15 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.Set ("key", "value", DateTimeOffset.MaxValue, "region"); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Set (null, "value", DateTimeOffset.MaxValue); }, "#A1-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Set ("key", null, DateTimeOffset.MaxValue); }, "#A1-3"); @@ -664,18 +664,18 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Set (null, new CacheItemPolicy ()); }, "#A1-1"); // Actually thrown from the Set (string, object, CacheItemPolicy, string) overload var ci = new CacheItem (null, "value"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Set (ci, new CacheItemPolicy ()); }, "#A1-2"); ci = new CacheItem ("key", null); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Set (ci, new CacheItemPolicy ()); }, "#A1-3"); @@ -683,14 +683,14 @@ namespace MonoTests.System.Runtime.Caching var cip = new CacheItemPolicy (); cip.UpdateCallback = (CacheEntryUpdateArguments arguments) => { }; cip.RemovedCallback = (CacheEntryRemovedArguments arguments) => { }; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc.Set (ci, cip); }, "#A1-4"); ci = new CacheItem ("key", "value"); cip = new CacheItemPolicy (); cip.SlidingExpiration = TimeSpan.MinValue; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.Set (ci, cip); }, "#A1-5"); @@ -703,7 +703,7 @@ namespace MonoTests.System.Runtime.Caching ci = new CacheItem ("key", "value"); cip = new CacheItemPolicy (); cip.SlidingExpiration = TimeSpan.FromDays (500); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.Set (ci, cip); }, "#A1-7"); @@ -716,7 +716,7 @@ namespace MonoTests.System.Runtime.Caching ci = new CacheItem ("key", "value"); cip = new CacheItemPolicy (); cip.Priority = (CacheItemPriority) 20; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mc.Set (ci, cip); }, "#A1-9"); @@ -752,11 +752,11 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.Remove ("key", "region"); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Remove (null); }, "#A1-2"); @@ -966,15 +966,15 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.GetValues ((string[]) null); }, "#A1-1"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.GetValues (new string[] {}, "region"); }, "#A1-2"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { mc.GetValues (new string [] { "key", null }); }, "#A1-3"); @@ -1012,11 +1012,11 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.Get ("key", "region"); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.Get (null); }, "#A1-2"); @@ -1072,11 +1072,11 @@ namespace MonoTests.System.Runtime.Caching { var mc = new PokerMemoryCache ("MyCache"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { mc.GetCacheItem ("key", "region"); }, "#A1-1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mc.GetCacheItem (null); }, "#A1-2"); @@ -1156,7 +1156,7 @@ namespace MonoTests.System.Runtime.Caching cip.ChangeMonitors.Add (monitor); // Thrown by ChangeMonitor.NotifyOnChanged - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { mc.Set ("key1", "value1", cip); }, "#A3"); } diff --git a/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/ObjectCacheTest.cs b/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/ObjectCacheTest.cs index e5eefb72970..b1fed63634e 100644 --- a/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/ObjectCacheTest.cs +++ b/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/ObjectCacheTest.cs @@ -48,7 +48,7 @@ namespace MonoTests.System.Runtime.Caching static void Host_SetToNull () { - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { ObjectCache.Host = null; }, "#A2"); } @@ -61,7 +61,7 @@ namespace MonoTests.System.Runtime.Caching Assert.IsNotNull (ObjectCache.Host, "#A3-1"); Assert.AreEqual (tns1, ObjectCache.Host, "#A3-2"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { ObjectCache.Host = tns2; }, "#A4"); } diff --git a/mcs/class/System.Web.Abstractions/System.Web.Abstractions_test.dll.sources b/mcs/class/System.Web.Abstractions/System.Web.Abstractions_test.dll.sources index f8dc12198ea..c7865c6a9ed 100644 --- a/mcs/class/System.Web.Abstractions/System.Web.Abstractions_test.dll.sources +++ b/mcs/class/System.Web.Abstractions/System.Web.Abstractions_test.dll.sources @@ -1,3 +1,2 @@ -../../System.Web.DynamicData/Test/Common/AssertExtensions.cs System.Web/HttpApplicationStateBaseTest.cs System.Web/HttpFileCollectionWrapperTest.cs diff --git a/mcs/class/System.Web.Abstractions/Test/System.Web/HttpFileCollectionWrapperTest.cs b/mcs/class/System.Web.Abstractions/Test/System.Web/HttpFileCollectionWrapperTest.cs index 14c41ea19fc..9e659054e76 100644 --- a/mcs/class/System.Web.Abstractions/Test/System.Web/HttpFileCollectionWrapperTest.cs +++ b/mcs/class/System.Web.Abstractions/Test/System.Web/HttpFileCollectionWrapperTest.cs @@ -30,8 +30,6 @@ using System; using System.Web; using NUnit.Framework; -using MonoTests.Common; - namespace MonoTests.System.Web { [TestFixture] @@ -55,7 +53,7 @@ namespace MonoTests.System.Web var files = req.Files; var wrapper = new HttpFileCollectionWrapper (files); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { wrapper.Get (0); }, "#A1"); } @@ -78,7 +76,7 @@ namespace MonoTests.System.Web var files = req.Files; var wrapper = new HttpFileCollectionWrapper (files); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { var f = wrapper [0]; }, "#A1"); } diff --git a/mcs/class/System.Web.DynamicData/System.Web.DynamicData_test.dll.sources b/mcs/class/System.Web.DynamicData/System.Web.DynamicData_test.dll.sources index 67e3e1a6408..6da1d6234b6 100644 --- a/mcs/class/System.Web.DynamicData/System.Web.DynamicData_test.dll.sources +++ b/mcs/class/System.Web.DynamicData/System.Web.DynamicData_test.dll.sources @@ -37,7 +37,6 @@ Assembly/AssemblyInfo.cs Common/AFieldTemplate.cs -Common/AssertExtensions.cs Common/AssociatedBar.cs Common/AssociatedFoo.cs Common/BazColumnAttributes.cs diff --git a/mcs/class/System.Web.DynamicData/Test/Common/AssertExtensions.cs b/mcs/class/System.Web.DynamicData/Test/Common/AssertExtensions.cs deleted file mode 100644 index 41e340bfd35..00000000000 --- a/mcs/class/System.Web.DynamicData/Test/Common/AssertExtensions.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; - -using NUnit.Framework; - -namespace MonoTests.Common -{ - delegate void AssertThrowsDelegate(); - - static class AssertExtensions - { - public static void AreEqual (byte[] expected, byte[] data, string message) - { - if (expected == null) { - if (data == null) - return; - Assert.Fail ("{0}{1}Expected: null{1}Got: byte array with {2} elements and of rank {3}{1}", - message, Environment.NewLine, data.Length, data.Rank); - } - - if (data == null) - Assert.Fail ("{0}{1}Expected: byte array with {2} elements and rank {3}{1}Got: null{1}", - message, Environment.NewLine, expected.Length, expected.Rank); - - if (expected.Rank > 1) - Assert.Fail ("Only single-dimensional arrays are supported."); - - if (expected.Rank != data.Rank || expected.Length != data.Length) - Assert.Fail ("{0}{1}Expected: byte array with {2} elements and rank {3}{1}Got: byte array with {4} elements and rank {5}{1}", - message, Environment.NewLine, expected.Length, expected.Rank, data.Length, data.Rank); - - int max = expected.Length; - for (int i = 0; i < max; i++) { - if (expected[i] != data[i]) - Assert.Fail ("{0}{1}Arrays differ at index {2}.{1}Expected 0x{3:X} got 0x{4:X}{1}", - message, Environment.NewLine, i, expected[i], data[i]); - } - } - - public static void Throws<ET> (AssertThrowsDelegate code, string message) - { - Throws(typeof(ET), code, message); - } - - public static void Throws(Type exceptionType, AssertThrowsDelegate code, string message) - { - if (code == null) - Assert.Fail("No code provided for the test."); - - Exception exception = null; - try - { - code(); - } - catch (Exception ex) - { - exception = ex; - } - - if (exceptionType == null) - { - if (exception == null) - Assert.Fail("{0}{1}Expected: any exception thrown{1}But was: no exception thrown{1}", - message, Environment.NewLine); - return; - } - - if (exception == null || exception.GetType() != exceptionType) - Assert.Fail("{0}{1}Expected: {2}{1}But was: {3}{1}{4}{1}", - message, - Environment.NewLine, - exceptionType, - exception == null ? "no exception" : exception.GetType().ToString(), - exception == null ? "no exception" : exception.ToString()); - } - - public static void Throws(AssertThrowsDelegate code, string message) - { - Throws(null, code, message); - } - } -} diff --git a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicControlTest.cs b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicControlTest.cs index 5656080a73d..b940a2dbfe7 100644 --- a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicControlTest.cs +++ b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicControlTest.cs @@ -362,7 +362,7 @@ namespace MonoTests.System.Web.DynamicData // at System.Web.DynamicData.DynamicControl.ResolveColumn() // at System.Web.DynamicData.DynamicControl.OnInit(EventArgs e) - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { var c = lc.FindChild<DynamicControl> ("FirstName"); }, "#A1"); } @@ -389,7 +389,7 @@ namespace MonoTests.System.Web.DynamicData // at System.Web.DynamicData.DynamicControl.ResolveColumn() // at System.Web.DynamicData.DynamicControl.OnInit(EventArgs e) - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { var dc = lc.FindChild<DynamicControl> ("FirstName"); }, "#A1"); } @@ -641,7 +641,7 @@ namespace MonoTests.System.Web.DynamicData Assert.AreEqual ("value", dc.GetAttribute ("MyAttribute"), "#B1"); // Nice... - AssertExtensions.Throws<KeyNotFoundException> (() => { + Assert.Throws<KeyNotFoundException> (() => { dc.GetAttribute ("NoSuchAttribute"); }, "#C1"); } diff --git a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataExtensionsTest.cs b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataExtensionsTest.cs index 1f57541ed63..3367d54a22a 100644 --- a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataExtensionsTest.cs +++ b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataExtensionsTest.cs @@ -128,7 +128,7 @@ namespace MonoTests.System.Web.DynamicData { FieldFormattingOptions fld = null; - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { fld.ConvertEditedValue (null); }, "#A1"); diff --git a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteHandlerTest.cs b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteHandlerTest.cs index b44c8bd9327..b03d5d40321 100644 --- a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteHandlerTest.cs +++ b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteHandlerTest.cs @@ -87,17 +87,17 @@ namespace MonoTests.System.Web.DynamicData var handler = route.RouteHandler = new DynamicDataRouteHandler (); // No null check is made, of course - throws from some internal method - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { handler.CreateHandler (null, t, PageAction.Details); }, "#A1"); // No null check again - this time throws from GetCustomPageVirtualPath - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { handler.CreateHandler (route, null, PageAction.Details); }, "#A2"); // And once again, no null check and thrown from GetCustomPageVirtualPath as well - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { handler.CreateHandler (route, t, null); }, "#A3"); } @@ -152,13 +152,13 @@ namespace MonoTests.System.Web.DynamicData Assert.IsNotNull (handler, "#A2"); // Lack of null check (for table) - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { handler.DoGetCustomPageVirtualPath (null, null); }, "#A2-1"); // Another missing null check (this time for Model)... Are null checks // out of fashion? - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { handler.DoGetCustomPageVirtualPath (t, String.Empty); }, "#A2-2"); @@ -193,7 +193,7 @@ namespace MonoTests.System.Web.DynamicData [Test] public void GetRequestContext () { - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { DynamicDataRouteHandler.GetRequestContext (null); }, "#A1"); @@ -220,7 +220,7 @@ namespace MonoTests.System.Web.DynamicData Assert.IsNotNull (t, "#A1"); // Surprise! A null check is present! - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { DynamicDataRouteHandler.GetRequestMetaTable (null); }, "#A2"); @@ -248,13 +248,13 @@ namespace MonoTests.System.Web.DynamicData Assert.IsNotNull (handler, "#A2"); // Lack of null check (for table) - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { handler.DoGetScaffoldPageVirtualPath (null, null); }, "#A2-1"); // Another missing null check (this time for Model)... Are null checks // out of fashion? - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { handler.DoGetScaffoldPageVirtualPath (t, String.Empty); }, "#A2-2"); @@ -343,7 +343,7 @@ namespace MonoTests.System.Web.DynamicData Assert.IsNotNull (t, "#A1"); // And following the tradition... [drum roll] - NO NULL CHECK! - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { DynamicDataRouteHandler.SetRequestMetaTable (null, t); }, "#A2"); diff --git a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteTest.cs b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteTest.cs index 1151fb86612..91cd764338c 100644 --- a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteTest.cs +++ b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/DynamicDataRouteTest.cs @@ -298,7 +298,7 @@ namespace MonoTests.System.Web.DynamicData var rd = new RouteData (); var hc = new HttpContextWrapper (HttpContext.Current); - AssertExtensions.Throws <ArgumentException> (() => { + Assert.Throws <ArgumentException> (() => { ddr.GetVirtualPath (new RequestContext (hc, rd), null); }, "#A1"); } @@ -444,7 +444,7 @@ namespace MonoTests.System.Web.DynamicData var rd = new RouteData (); var hc = new HttpContextWrapper (HttpContext.Current); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { ddr.GetVirtualPath (new RequestContext (hc, rd), null); }, "#A1"); } diff --git a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateFactoryTest.cs b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateFactoryTest.cs index 8362f3b6a96..978a6e1b772 100644 --- a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateFactoryTest.cs +++ b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateFactoryTest.cs @@ -135,11 +135,11 @@ namespace MonoTests.System.Web.DynamicData MetaColumn mc = t.GetColumn ("Column1"); var ftf = new FieldTemplateFactory (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { ftf.BuildVirtualPath (null, mc, DataBoundControlMode.ReadOnly); }, "#A1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { ftf.BuildVirtualPath (String.Empty, mc, DataBoundControlMode.ReadOnly); }, "#A2"); @@ -179,7 +179,7 @@ namespace MonoTests.System.Web.DynamicData var ftf = new FieldTemplateFactory (); // And here we go again... - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.CreateFieldTemplate (null, DataBoundControlMode.ReadOnly, "Integer.ascx"); }, "#A1"); @@ -187,17 +187,17 @@ namespace MonoTests.System.Web.DynamicData // Not going to emulate those on Mono. There are limits... // ...and again - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.CreateFieldTemplate (mc, DataBoundControlMode.ReadOnly, null); }, "#A2"); // ...and again - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.CreateFieldTemplate (mc, DataBoundControlMode.ReadOnly, String.Empty); }, "#A3"); // ...and again - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.CreateFieldTemplate (mc, DataBoundControlMode.ReadOnly, "NoSuchTemplate"); }, "#A4"); #endif @@ -254,7 +254,7 @@ namespace MonoTests.System.Web.DynamicData Assert.AreEqual (ftf.TemplateFolderVirtualPath + "MyCustomUIHintTemplate_Text.ascx", ftuc.AppRelativeVirtualPath, "#E2-2"); mc = t.GetColumn ("FavoriteColor"); - AssertExtensions.Throws<HttpException> (() => { + Assert.Throws<HttpException> (() => { template = ftf.CreateFieldTemplate (mc, DataBoundControlMode.ReadOnly, "PlainControlTemplate"); }, "#F1"); @@ -280,23 +280,23 @@ namespace MonoTests.System.Web.DynamicData var ftf = new FieldTemplateFactory (); // And here we go again... - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.GetFieldTemplateVirtualPath (null, DataBoundControlMode.ReadOnly, "Integer.ascx"); }, "#A1"); #if TARGET_DOTNET // ...and again - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null); }, "#A2"); // ...and again - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, String.Empty); }, "#A3"); // ...and again - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "NoSuchTemplate"); }, "#A4"); #endif @@ -601,7 +601,7 @@ namespace MonoTests.System.Web.DynamicData ftf.Initialize (m); // Ugh... - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.GetFieldTemplateVirtualPath (null, DataBoundControlMode.ReadOnly, "Integer.ascx"); }, "#A1"); @@ -634,11 +634,11 @@ namespace MonoTests.System.Web.DynamicData // Custom type // It appears that DataTypeAttribute's custom type name is passed to BuildVirtualPath - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { string path = ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null); }, "#A1"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { string path = ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "NoSuchTemplate"); }, "#A1-1"); Assert.AreEqual (ftf.TemplateFolderVirtualPath + "Boolean.ascx", ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "Boolean"), "#A1-2"); @@ -649,11 +649,11 @@ namespace MonoTests.System.Web.DynamicData AssertHelper.Greater (mc.UIHint.Length, 0, "#A2-1"); // Proves that UIHint on the column is not used, just the uiHint argument - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { string path = ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, null); }, "#A2-2"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { string path = ftf.GetFieldTemplateVirtualPath (mc, DataBoundControlMode.ReadOnly, "NoSuchTemplate"); }, "#A2-3"); @@ -913,7 +913,7 @@ namespace MonoTests.System.Web.DynamicData var ftf = new FieldTemplateFactory (); ftf.Initialize (m); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { ftf.PreprocessMode (null, DataBoundControlMode.ReadOnly); }, "#A1"); @@ -1007,7 +1007,7 @@ namespace MonoTests.System.Web.DynamicData ftf.TemplateFolderVirtualPath = String.Empty; // Thrown from some internal method - no checks _again_ - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { string path = ftf.TemplateFolderVirtualPath; }, "#A8"); @@ -1041,7 +1041,7 @@ namespace MonoTests.System.Web.DynamicData ftf.Initialize (m); ftf.TemplateFolderVirtualPath = String.Empty; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { string path = ftf.TemplateFolderVirtualPath; }, "#G1"); } diff --git a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateUserControlTest.cs b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateUserControlTest.cs index 423237d1ec0..ab09cd20c21 100644 --- a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateUserControlTest.cs +++ b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/FieldTemplateUserControlTest.cs @@ -146,12 +146,12 @@ namespace MonoTests.System.Web.DynamicData field.Page = p; ((IFieldTemplate) field).SetHost (dc); - AssertExtensions.Throws<Exception> (() => { + Assert.Throws<Exception> (() => { var f = field.ChildrenColumn; }, "#C1"); // The FirstName column is not a children one - AssertExtensions.Throws<Exception> (() => { + Assert.Throws<Exception> (() => { field.GetChildrenPath (); }, "#C2"); Assert.IsNotNull (field.Column, "#C3"); @@ -181,10 +181,10 @@ namespace MonoTests.System.Web.DynamicData //Assert.IsNull (field.FieldValueString, "#C7"); // The FirstName column is not a foreign key one - AssertExtensions.Throws<Exception> (() => { + Assert.Throws<Exception> (() => { var f = field.ForeignKeyColumn; }, "#C8"); - AssertExtensions.Throws<Exception> (() => { + Assert.Throws<Exception> (() => { var f = field.GetForeignKeyPath (); }, "#C9"); Assert.IsNotNull (field.Host, "#C10"); diff --git a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaModelTest.cs b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaModelTest.cs index ed33152de0d..281efe05b26 100644 --- a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaModelTest.cs +++ b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaModelTest.cs @@ -237,8 +237,8 @@ namespace MonoTests.System.Web.DynamicData public void GetModel () { Utils.GetModel<UseOnlyInGetModelTestDataContext> (); - AssertExtensions.Throws<ArgumentNullException> (() => MetaModel.GetModel (null), "#A1"); - AssertExtensions.Throws<InvalidOperationException> (() => MetaModel.GetModel (typeof (object)), "#A2"); + Assert.Throws<ArgumentNullException> (() => MetaModel.GetModel (null), "#A1"); + Assert.Throws<InvalidOperationException> (() => MetaModel.GetModel (typeof (object)), "#A2"); Assert.IsNotNull (MetaModel.GetModel (typeof (UseOnlyInGetModelTestDataContext))); } @@ -248,7 +248,7 @@ namespace MonoTests.System.Web.DynamicData MetaModel m = Utils.GetModel<MyDataContext2> (); MetaTable t; - AssertExtensions.Throws<ArgumentNullException> (() => m.TryGetTable (null, out t), "#A1"); + Assert.Throws<ArgumentNullException> (() => m.TryGetTable (null, out t), "#A1"); Assert.IsTrue (m.TryGetTable ("FooTable", out t), "#B1"); Assert.IsNotNull (t, "#B2"); @@ -268,17 +268,17 @@ namespace MonoTests.System.Web.DynamicData string str = null; Type type = null; - AssertExtensions.Throws<ArgumentNullException> (() => t = m.GetTable (str), "#A1"); - AssertExtensions.Throws<ArgumentNullException> (() => t = m.GetTable (type), "#A2"); - AssertExtensions.Throws<ArgumentNullException> (() => t = m.GetTable (null, null), "#A3"); - AssertExtensions.Throws<ArgumentNullException> (() => t = m.GetTable (null, typeof (Foo)), "#A4"); - AssertExtensions.Throws<ArgumentNullException> (() => t = m.GetTable ("FooTable", null), "#A5"); + Assert.Throws<ArgumentNullException> (() => t = m.GetTable (str), "#A1"); + Assert.Throws<ArgumentNullException> (() => t = m.GetTable (type), "#A2"); + Assert.Throws<ArgumentNullException> (() => t = m.GetTable (null, null), "#A3"); + Assert.Throws<ArgumentNullException> (() => t = m.GetTable (null, typeof (Foo)), "#A4"); + Assert.Throws<ArgumentNullException> (() => t = m.GetTable ("FooTable", null), "#A5"); - AssertExtensions.Throws<ArgumentException> (() => t = m.GetTable (String.Empty), "#B1"); - AssertExtensions.Throws<ArgumentException> (() => t = m.GetTable ("NoSuchName"), "#B2"); - AssertExtensions.Throws<ArgumentException> (() => t = m.GetTable (typeof (object)), "#B3"); - AssertExtensions.Throws<ArgumentException> (() => t = m.GetTable ("FooTable", typeof (object)), "#B4"); - AssertExtensions.Throws<ArgumentException> (() => t = m.GetTable ("NoSuchTable", typeof (object)), "#B5"); + Assert.Throws<ArgumentException> (() => t = m.GetTable (String.Empty), "#B1"); + Assert.Throws<ArgumentException> (() => t = m.GetTable ("NoSuchName"), "#B2"); + Assert.Throws<ArgumentException> (() => t = m.GetTable (typeof (object)), "#B3"); + Assert.Throws<ArgumentException> (() => t = m.GetTable ("FooTable", typeof (object)), "#B4"); + Assert.Throws<ArgumentException> (() => t = m.GetTable ("NoSuchTable", typeof (object)), "#B5"); Assert.IsNotNull (t = m.GetTable ("FooTable"), "#C1"); Assert.AreEqual (typeof (Foo), t.EntityType, "#C2"); @@ -296,11 +296,11 @@ namespace MonoTests.System.Web.DynamicData // None of those are thrown from GetTable - it seems this method performs NO checks at all, sigh... // - //AssertExtensions.Throws<ArgumentNullException> (() => m.GetActionPath (null, PageAction.List, foo), "#A1"); - //AssertExtensions.Throws<ArgumentException> (() => m.GetActionPath (String.Empty, PageAction.List, foo), "#A2"); - //AssertExtensions.Throws<ArgumentNullException> (() => m.GetActionPath ("FooTable", null, foo), "#A3"); - //AssertExtensions.Throws<ArgumentNullException> (() => m.GetActionPath ("FooTable", PageAction.List, null), "#A4"); - //AssertExtensions.Throws<ArgumentException> (() => m.GetActionPath ("NoSuchTable", PageAction.List, foo), "#A5"); + //Assert.Throws<ArgumentNullException> (() => m.GetActionPath (null, PageAction.List, foo), "#A1"); + //Assert.Throws<ArgumentException> (() => m.GetActionPath (String.Empty, PageAction.List, foo), "#A2"); + //Assert.Throws<ArgumentNullException> (() => m.GetActionPath ("FooTable", null, foo), "#A3"); + //Assert.Throws<ArgumentNullException> (() => m.GetActionPath ("FooTable", PageAction.List, null), "#A4"); + //Assert.Throws<ArgumentException> (() => m.GetActionPath ("NoSuchTable", PageAction.List, foo), "#A5"); } [Test] @@ -323,10 +323,10 @@ namespace MonoTests.System.Web.DynamicData // // at System.Web.DynamicData.MetaModel.TryGetTable(String uniqueTableName, MetaTable& table) // at System.Web.DynamicData.MetaModel.GetTable(String uniqueTableName) - AssertExtensions.Throws<ArgumentNullException> (() => m.GetActionPath (null, PageAction.List, foo), "#A1"); + Assert.Throws<ArgumentNullException> (() => m.GetActionPath (null, PageAction.List, foo), "#A1"); Assert.AreEqual (String.Empty, m.GetActionPath ("FooTable", null, foo), "#A2"); Assert.AreEqual ("/FooTable/List.aspx", m.GetActionPath ("FooTable", PageAction.List, null), "#A3"); - AssertExtensions.Throws<ArgumentException> (() => m.GetActionPath ("NoSuchTable", PageAction.List, foo), "#A4"); + Assert.Throws<ArgumentException> (() => m.GetActionPath ("NoSuchTable", PageAction.List, foo), "#A4"); Assert.AreEqual ("/FooTable/List.aspx", m.GetActionPath ("FooTable", "List", foo), "#B1"); } diff --git a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaTableTest.cs b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaTableTest.cs index b51fb6d7314..0f1971dcbe9 100644 --- a/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaTableTest.cs +++ b/mcs/class/System.Web.DynamicData/Test/System.Web.DynamicData/MetaTableTest.cs @@ -170,7 +170,7 @@ namespace MonoTests.System.Web.DynamicData Assert.AreEqual ("Column2", mc.Name, "#A2"); t = m.Tables[TestDataContext.TableFooEmpty]; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => mc = t.DisplayColumn, "#B1"); + Assert.Throws<ArgumentOutOfRangeException> (() => mc = t.DisplayColumn, "#B1"); t = m.Tables[TestDataContext.TableFooWithDefaults]; mc = t.DisplayColumn; @@ -193,9 +193,9 @@ namespace MonoTests.System.Web.DynamicData Assert.AreEqual ("Column1", mc.Name, "#F2"); t = m.Tables[TestDataContext.TableFooInvalidDisplayColumnAttribute]; - AssertExtensions.Throws<InvalidOperationException> (() => mc = t.DisplayColumn, "#G1"); + Assert.Throws<InvalidOperationException> (() => mc = t.DisplayColumn, "#G1"); t = m.Tables[TestDataContext.TableFooEmptyDisplayColumnAttribute]; - AssertExtensions.Throws<InvalidOperationException> (() => mc = t.DisplayColumn, "#G2"); + Assert.Throws<InvalidOperationException> (() => mc = t.DisplayColumn, "#G2"); t = m.Tables[TestDataContext.TableFooWithMetadataType]; mc = t.DisplayColumn; @@ -369,7 +369,7 @@ namespace MonoTests.System.Web.DynamicData // Yet another lack of parameter checking - the number of items passed in the dataList must be at least equal // to the number of columns in the PrimaryKeyColumns collection - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => t.GetActionPath (PageAction.Details, dataList), "#A2"); + Assert.Throws<ArgumentOutOfRangeException> (() => t.GetActionPath (PageAction.Details, dataList), "#A2"); dataList.Add (2); dataList.Add (false); @@ -401,20 +401,20 @@ namespace MonoTests.System.Web.DynamicData var values = new RouteValueDictionary (); // NO null check for the routeValues parameter _again_! - AssertExtensions.Throws<NullReferenceException> (() => t.GetActionPath (PageAction.Details, (RouteValueDictionary) null), "#A1"); + Assert.Throws<NullReferenceException> (() => t.GetActionPath (PageAction.Details, (RouteValueDictionary) null), "#A1"); Assert.AreEqual (Utils.BuildActionName (t, PageAction.Details), t.GetActionPath (PageAction.Details, values), "#A2"); Assert.AreEqual (2, values.Count, "#A3"); // GetActionPath does not check if the Action and Table keys are present in the dictionary... values.Clear (); values.Add ("Action", "something"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { t.GetActionPath (PageAction.Details, values); }, "#B1"); values.Clear (); values.Add ("Table", "else"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { t.GetActionPath (PageAction.Details, values); }, "#B2"); } @@ -429,7 +429,7 @@ namespace MonoTests.System.Web.DynamicData var foo = new FooWithDefaults (); Assert.AreEqual (String.Empty, t.GetActionPath (null, (object) null), "#A1"); - AssertExtensions.Throws<HttpException> (() => t.GetActionPath (PageAction.Details, (object) "test"), "#A2"); + Assert.Throws<HttpException> (() => t.GetActionPath (PageAction.Details, (object) "test"), "#A2"); Assert.AreEqual (Utils.BuildActionName (t, PageAction.Details, "PrimaryKeyColumn1=primary%20key%20value&PrimaryKeyColumn2=456&PrimaryKeyColumn3=True"), t.GetActionPath (PageAction.Details, foo), "#A3"); t = m.Tables[TestDataContext.TableFooNoDefaultsWithPrimaryKey]; @@ -490,7 +490,7 @@ namespace MonoTests.System.Web.DynamicData // Yet another lack of parameter checking - the number of items passed in the dataList must be at least equal // to the number of columns in the PrimaryKeyColumns collection - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => t.GetActionPath (PageAction.Details, dataList), "#A3"); + Assert.Throws<ArgumentOutOfRangeException> (() => t.GetActionPath (PageAction.Details, dataList), "#A3"); dataList.Add (2); dataList.Add (false); @@ -540,9 +540,9 @@ namespace MonoTests.System.Web.DynamicData MetaTable t = m.Tables[TestDataContext.TableFooWithDefaults]; - AssertExtensions.Throws<ArgumentNullException> (() => t.GetColumn (null), "#A1"); - AssertExtensions.Throws<InvalidOperationException> (() => t.GetColumn (String.Empty), "#A2"); - AssertExtensions.Throws<InvalidOperationException> (() => t.GetColumn ("NoSuchColumn"), "#A3"); + Assert.Throws<ArgumentNullException> (() => t.GetColumn (null), "#A1"); + Assert.Throws<InvalidOperationException> (() => t.GetColumn (String.Empty), "#A2"); + Assert.Throws<InvalidOperationException> (() => t.GetColumn ("NoSuchColumn"), "#A3"); MetaColumn mc = t.GetColumn ("Column1"); Assert.IsNotNull (mc, "#B1"); @@ -559,9 +559,9 @@ namespace MonoTests.System.Web.DynamicData var foo = new FooWithDefaults (); Assert.AreEqual (String.Empty, t.GetDisplayString (null), "#A1"); - AssertExtensions.Throws<HttpException> (() => t.GetDisplayString (String.Empty), "#A2"); + Assert.Throws<HttpException> (() => t.GetDisplayString (String.Empty), "#A2"); Assert.AreEqual ("hello", t.GetDisplayString (foo), "#A3"); - AssertExtensions.Throws<HttpException> (() => t.GetDisplayString ("TestString"), "#A4"); + Assert.Throws<HttpException> (() => t.GetDisplayString ("TestString"), "#A4"); // The method looks at the entity type to see if it has an overriden ToString method, // it ignores such methods on the passed "row" @@ -645,7 +645,7 @@ namespace MonoTests.System.Web.DynamicData Assert.AreEqual ("primary key value,456,True", t.GetPrimaryKeyString (foo), "#A2"); var foo2 = new FooNoDefaultsWithPrimaryKey (); - AssertExtensions.Throws<HttpException> (() => t.GetPrimaryKeyString (foo2), "#B1"); + Assert.Throws<HttpException> (() => t.GetPrimaryKeyString (foo2), "#B1"); t = m.Tables[TestDataContext.TableFooSettableDefaults]; var foo3 = new FooSettableDefaults (null, null, null); @@ -668,7 +668,7 @@ namespace MonoTests.System.Web.DynamicData var foo = new FooWithDefaults (); Assert.IsNull (t.GetPrimaryKeyValues (null), "#A1"); - AssertExtensions.Throws<HttpException> (() => t.GetPrimaryKeyValues ("test"), "#A2"); + Assert.Throws<HttpException> (() => t.GetPrimaryKeyValues ("test"), "#A2"); IList<object> ret = t.GetPrimaryKeyValues (foo); Assert.IsNotNull (ret, "#B1"); @@ -780,7 +780,7 @@ namespace MonoTests.System.Web.DynamicData Assert.IsTrue (query.GetType () == typeof (Table<Foo>), "#A2"); var foo = new Foo (true); - AssertExtensions.Throws (() => t.GetQuery (foo), "#B1"); + Assert.Throws<InvalidCastException> (() => t.GetQuery (foo), "#B1"); } [Test] @@ -902,7 +902,7 @@ namespace MonoTests.System.Web.DynamicData MetaColumn mc; t = m.Tables[TestDataContext.TableFooMisnamedSortColumn]; - AssertExtensions.Throws <InvalidOperationException> (() => mc = t.SortColumn, "#C1"); + Assert.Throws <InvalidOperationException> (() => mc = t.SortColumn, "#C1"); t = m.Tables[TestDataContext.TableFooEmptySortColumn]; Assert.IsNull (t.SortColumn, "#D1"); @@ -943,7 +943,7 @@ namespace MonoTests.System.Web.DynamicData MetaTable t = m.Tables[TestDataContext.TableFooWithDefaults]; MetaColumn mc = null; - AssertExtensions.Throws<ArgumentNullException> (() => t.TryGetColumn (null, out mc), "#A1"); + Assert.Throws<ArgumentNullException> (() => t.TryGetColumn (null, out mc), "#A1"); Assert.IsFalse (t.TryGetColumn (String.Empty, out mc), "#A2"); Assert.IsNull (mc, "#A2-1"); Assert.IsTrue (t.TryGetColumn ("Column1", out mc), "#A3"); diff --git a/mcs/class/System.Web.Routing/System.Web.Routing_test.dll.sources b/mcs/class/System.Web.Routing/System.Web.Routing_test.dll.sources index 43a05efd883..33a61b936e6 100644 --- a/mcs/class/System.Web.Routing/System.Web.Routing_test.dll.sources +++ b/mcs/class/System.Web.Routing/System.Web.Routing_test.dll.sources @@ -1,4 +1,3 @@ -System.Web.Routing/AssertExtensions.cs System.Web.Routing/FakeHttpWorkerRequest.cs System.Web.Routing/HttpMethodConstraintTest.cs System.Web.Routing/KnownResponseHeader.cs diff --git a/mcs/class/System.Web.Routing/Test/System.Web.Routing/AssertExtensions.cs b/mcs/class/System.Web.Routing/Test/System.Web.Routing/AssertExtensions.cs deleted file mode 100644 index b5441652224..00000000000 --- a/mcs/class/System.Web.Routing/Test/System.Web.Routing/AssertExtensions.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// AssertExtensions.cs -// -// Author: -// Marek Habersack <mhabersack@novell.com> -// -// Copyright (C) 2009 Novell Inc. http://novell.com -// - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.Web; -using System.Web.Routing; -using NUnit.Framework; - -namespace MonoTests.System.Web.Routing -{ - public delegate void AssertThrowsDelegate (); - - public static class AssertExtensions - { - public static void Throws <EX> (AssertThrowsDelegate code) - { - Throws (typeof (EX), code); - } - - public static void Throws <EX> (AssertThrowsDelegate code, string message) - { - Throws (typeof (EX), code, message); - } - - public static void Throws (Type exceptionType, AssertThrowsDelegate code) - { - Throws (exceptionType, code, String.Empty); - } - - public static void Throws (Type exceptionType, AssertThrowsDelegate code, string message) - { - if (code == null) - throw new ArgumentNullException ("code"); - if (exceptionType == null) - throw new ArgumentNullException ("exceptionType"); - - try { - code (); - } catch (Exception ex) { - if (ex.GetType () != exceptionType) - Assert.Fail (message + " (got exception of type '" + ex.GetType () + "')"); - - // good! - return; - } - - Assert.Fail (message); - } - } -} diff --git a/mcs/class/System.Web.Routing/Test/System.Web.Routing/RequestContext.cs b/mcs/class/System.Web.Routing/Test/System.Web.Routing/RequestContext.cs index 5d2aeceb855..d63053bb1d2 100644 --- a/mcs/class/System.Web.Routing/Test/System.Web.Routing/RequestContext.cs +++ b/mcs/class/System.Web.Routing/Test/System.Web.Routing/RequestContext.cs @@ -53,12 +53,12 @@ namespace MonoTests.System.Web.Routing { RequestContext rc; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { rc = new RequestContext (null, new RouteData ()); }, "#A1"); var ctx = new HttpContextWrapper (new HttpContext (new HttpRequest ("filename", "http://localhost/filename", String.Empty), new HttpResponse (new StringWriter ()))); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { rc = new RequestContext (ctx, null); }, "#A2"); } diff --git a/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteCollectionTest.cs b/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteCollectionTest.cs index c2d2d51a28d..a4145730a33 100644 --- a/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteCollectionTest.cs +++ b/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteCollectionTest.cs @@ -644,7 +644,7 @@ namespace MonoTests.System.Web.Routing { var c = new RouteCollection (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { c.Ignore (null); }, "#A1"); @@ -666,7 +666,7 @@ namespace MonoTests.System.Web.Routing { var c = new RouteCollection (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { c.Ignore (null, new { allaspx = @".*\.aspx(/.*)?" }); }, "#A1"); @@ -686,7 +686,7 @@ namespace MonoTests.System.Web.Routing c = new RouteCollection (); c.Ignore ("{*allaspx}", "something invalid"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { rd = c.GetRouteData (hc); }, "#A2"); } @@ -706,7 +706,7 @@ namespace MonoTests.System.Web.Routing Assert.AreEqual (typeof (PageRouteHandler), rd.RouteHandler.GetType (), "#A1-3"); c = new RouteCollection (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { c.MapPageRoute ("RouteName", null, "~/some-url"); }, "#A2"); @@ -718,7 +718,7 @@ namespace MonoTests.System.Web.Routing c = new RouteCollection (); // thrown by PageRouteHandler's constructor - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { c.MapPageRoute ("RouteName", "~/some-url", null); }, "#A3"); } @@ -739,7 +739,7 @@ namespace MonoTests.System.Web.Routing Assert.IsTrue (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A1-4"); c = new RouteCollection (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { c.MapPageRoute ("RouteName", null, "~/some-url", true); }, "#A2"); @@ -751,7 +751,7 @@ namespace MonoTests.System.Web.Routing c = new RouteCollection (); // thrown by PageRouteHandler's constructor - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { c.MapPageRoute ("RouteName", "~/some-url", null, true); }, "#A3"); @@ -781,7 +781,7 @@ namespace MonoTests.System.Web.Routing Assert.IsTrue (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A1-4"); c = new RouteCollection (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { c.MapPageRoute ("RouteName", null, "~/some-url", true, defaults); }, "#A2"); @@ -793,7 +793,7 @@ namespace MonoTests.System.Web.Routing c = new RouteCollection (); // thrown by PageRouteHandler's constructor - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { c.MapPageRoute ("RouteName", "~/some-url", null, true, defaults); }, "#A3"); @@ -832,7 +832,7 @@ namespace MonoTests.System.Web.Routing Assert.IsTrue (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A1-4"); c = new RouteCollection (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { c.MapPageRoute ("RouteName", null, "~/some-url", true, defaults, constraints); }, "#A2"); @@ -844,7 +844,7 @@ namespace MonoTests.System.Web.Routing c = new RouteCollection (); // thrown by PageRouteHandler's constructor - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { c.MapPageRoute ("RouteName", "~/some-url", null, true, defaults, constraints); }, "#A3"); @@ -884,7 +884,7 @@ namespace MonoTests.System.Web.Routing Assert.IsTrue (((PageRouteHandler) rd.RouteHandler).CheckPhysicalUrlAccess, "#A1-4"); c = new RouteCollection (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { c.MapPageRoute ("RouteName", null, "~/some-url", true, defaults, constraints, dataTokens); }, "#A2"); @@ -896,7 +896,7 @@ namespace MonoTests.System.Web.Routing c = new RouteCollection (); // thrown by PageRouteHandler's constructor - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { c.MapPageRoute ("RouteName", "~/some-url", null, true, defaults, constraints, dataTokens); }, "#A3"); diff --git a/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs b/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs index c9fd18a29cf..4bdd51c5dd6 100644 --- a/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs +++ b/mcs/class/System.Web.Routing/Test/System.Web.Routing/RouteTest.cs @@ -113,7 +113,7 @@ namespace MonoTests.System.Web.Routing Route r; foreach (TestUrl tu in __invalidUrls) { - AssertExtensions.Throws (tu.ExpectedExceptionType, () => r = new Route (tu.Url, null), tu.Label); + Assert.Throws (tu.ExpectedExceptionType, () => r = new Route (tu.Url, null), tu.Label); } } @@ -1763,18 +1763,18 @@ namespace MonoTests.System.Web.Routing Assert.IsFalse (route.DoProcessConstraint (null, "regex", "parameter", new RouteValueDictionary (), RouteDirection.IncomingRequest), "#1"); // constraint is null - AssertExtensions.Throws <InvalidOperationException> ( + Assert.Throws <InvalidOperationException> ( () => route.DoProcessConstraint (null, null, "parameter", new RouteValueDictionary (), RouteDirection.IncomingRequest), "#2" ); // constraint is neither a string or an IRouteConstraint instance - AssertExtensions.Throws <InvalidOperationException> ( + Assert.Throws <InvalidOperationException> ( () => route.DoProcessConstraint (null, 1, "parameter", new RouteValueDictionary (), RouteDirection.IncomingRequest), "#3" ); - AssertExtensions.Throws <ArgumentNullException> ( + Assert.Throws <ArgumentNullException> ( () => route.DoProcessConstraint (null, "regex", null, new RouteValueDictionary (), RouteDirection.IncomingRequest), "#4" ); @@ -1782,7 +1782,7 @@ namespace MonoTests.System.Web.Routing Assert.IsFalse (route.DoProcessConstraint (null, "regex", String.Empty, new RouteValueDictionary (), RouteDirection.IncomingRequest), "#5"); // This is a .NET programming error, so not sure if we should test for this... - AssertExtensions.Throws <NullReferenceException> ( + Assert.Throws <NullReferenceException> ( () => route.DoProcessConstraint (null, "regex", "parameter", null, RouteDirection.IncomingRequest), "#6" ); diff --git a/mcs/class/System.Web/System.Web_test.dll.sources b/mcs/class/System.Web/System.Web_test.dll.sources index 7b1f02c8e82..d658e963f1b 100644 --- a/mcs/class/System.Web/System.Web_test.dll.sources +++ b/mcs/class/System.Web/System.Web_test.dll.sources @@ -1,5 +1,4 @@ ../../test-helpers/NunitHelpers.cs -../../System.Web.DynamicData/Test/Common/AssertExtensions.cs mainsoft/MainsoftWebTest/HtmlAgilityPack/AssemblyInfo.cs mainsoft/MainsoftWebTest/HtmlAgilityPack/crc32.cs mainsoft/MainsoftWebTest/HtmlAgilityPack/Header.cs diff --git a/mcs/class/System.Web/Test/System.Web.Caching/FileResponseElementTest.cs b/mcs/class/System.Web/Test/System.Web.Caching/FileResponseElementTest.cs index ac14cee58ba..0397f44a43e 100644 --- a/mcs/class/System.Web/Test/System.Web.Caching/FileResponseElementTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Caching/FileResponseElementTest.cs @@ -33,7 +33,6 @@ using System.Web; using System.Web.Caching; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.Caching { @@ -45,15 +44,15 @@ namespace MonoTests.System.Web.Caching { FileResponseElement fre; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { fre = new FileResponseElement (null, 0, 0); }, "#A1"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { fre = new FileResponseElement ("file.txt", -1, 0); }, "#A2"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { fre = new FileResponseElement ("file.txt", 0, -1); }, "#A3"); diff --git a/mcs/class/System.Web/Test/System.Web.Caching/HeaderElementTest.cs b/mcs/class/System.Web/Test/System.Web.Caching/HeaderElementTest.cs index 7a6a7434b8a..f21202c0bb1 100644 --- a/mcs/class/System.Web/Test/System.Web.Caching/HeaderElementTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Caching/HeaderElementTest.cs @@ -33,7 +33,6 @@ using System.Web; using System.Web.Caching; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.Caching { @@ -45,11 +44,11 @@ namespace MonoTests.System.Web.Caching { HeaderElement he; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { he = new HeaderElement (null, String.Empty); }, "#A1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { he = new HeaderElement ("Header", null); }, "#A2"); diff --git a/mcs/class/System.Web/Test/System.Web.Caching/MemoryResponseElementTest.cs b/mcs/class/System.Web/Test/System.Web.Caching/MemoryResponseElementTest.cs index bfee3cc479b..2f7ba0e5571 100644 --- a/mcs/class/System.Web/Test/System.Web.Caching/MemoryResponseElementTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Caching/MemoryResponseElementTest.cs @@ -33,7 +33,7 @@ using System.Web; using System.Web.Caching; using NUnit.Framework; -using MonoTests.Common; + namespace MonoTests.System.Web.Caching { @@ -45,15 +45,15 @@ namespace MonoTests.System.Web.Caching { MemoryResponseElement mre; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { mre = new MemoryResponseElement (null, 0); }, "#A1"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mre = new MemoryResponseElement (new byte[1], -1); }, "#A2"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { mre = new MemoryResponseElement (new byte[1], 2); }, "#A2"); diff --git a/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs b/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs index 9c36368ba7d..7b45144d423 100644 --- a/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs @@ -36,7 +36,6 @@ using System.Web.Caching; using System.Web.Configuration; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.Caching { @@ -166,17 +165,17 @@ namespace MonoTests.System.Web.Caching { ResponseElement data = new MemoryResponseElement (new byte[10], 10); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { OutputCache.Serialize (null, data); }, "#A1"); var ms = new MemoryStream (); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { OutputCache.Serialize (ms, null); }, "#A2"); foreach (object o in serializeObjects) { - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { OutputCache.Serialize (ms, o); }, String.Format ("#A3-{0}", o.GetType ())); } @@ -194,28 +193,28 @@ namespace MonoTests.System.Web.Caching #endif byte[] bytes = SerializeElement (mre); - AssertExtensions.AreEqual (bytes, memoryResponseElement, "#B1"); + Assert.AreEqual (bytes, memoryResponseElement, "#B1"); bytes = SerializeElement (fre); - AssertExtensions.AreEqual (bytes, fileResponseElement, "#B2"); + Assert.AreEqual (bytes, fileResponseElement, "#B2"); bytes = SerializeElement (sre); - AssertExtensions.AreEqual (bytes, substitutionResponseElement, "#B3"); + Assert.AreEqual (bytes, substitutionResponseElement, "#B3"); bytes = SerializeElement (sreBad); - AssertExtensions.AreEqual (bytes, badSubstitutionResponseElement, "#B4"); + Assert.AreEqual (bytes, badSubstitutionResponseElement, "#B4"); } [Test] public void Deserialize () { - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { OutputCache.Deserialize (null); }, "#A1"); foreach (object o in serializeObjects) { using (var m = new MemoryStream (SerializeToBinary (o))) { - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { OutputCache.Deserialize (m); }, String.Format ("#A2-{0}", o.GetType ())); } @@ -231,7 +230,7 @@ namespace MonoTests.System.Web.Caching using (ms = new MemoryStream (memoryResponseElement)) mreOrig = OutputCache.Deserialize (ms) as MemoryResponseElement; Assert.IsNotNull (mreOrig, "#B1-1"); - AssertExtensions.AreEqual (mreOrig.Buffer, mre.Buffer, "#B1-2"); + Assert.AreEqual (mreOrig.Buffer, mre.Buffer, "#B1-2"); Assert.AreEqual (mreOrig.Length, mre.Length, "#B1-3"); using (ms = new MemoryStream (fileResponseElement)) @@ -247,7 +246,7 @@ namespace MonoTests.System.Web.Caching Assert.AreEqual (sreOrig.Callback, sre.Callback, "#D1"); // Callback here is not a static method - Substitution delegates must be static - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { using (ms = new MemoryStream (badSubstitutionResponseElement)) sreBadOrig = OutputCache.Deserialize (ms) as SubstitutionResponseElement; }, "#E1"); diff --git a/mcs/class/System.Web/Test/System.Web.Caching/SqlCacheDependencyTest.cs b/mcs/class/System.Web/Test/System.Web.Caching/SqlCacheDependencyTest.cs index e26dafb8ce9..6e3c48fad14 100644 --- a/mcs/class/System.Web/Test/System.Web.Caching/SqlCacheDependencyTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Caching/SqlCacheDependencyTest.cs @@ -30,7 +30,6 @@ using System.Web; using System.Web.Caching; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.Caching { @@ -41,7 +40,7 @@ namespace MonoTests.System.Web.Caching public void Constructor_1 () { SqlCacheDependency sqc; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { sqc = new SqlCacheDependency (null); }, "#A1"); } @@ -51,16 +50,16 @@ namespace MonoTests.System.Web.Caching { SqlCacheDependency sqc; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { sqc = new SqlCacheDependency (null, "myTable"); }, "#A1"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { sqc = new SqlCacheDependency ("myDatabase", null); }, "#A2"); // Cannot be tested without an existing database - //AssertExtensions.Throws<ArgumentNullException> (() => { + //Assert.Throws<ArgumentNullException> (() => { // sqc = new SqlCacheDependency ("myDatabase", "myTable"); //}, "#A3"); } @@ -70,15 +69,15 @@ namespace MonoTests.System.Web.Caching { CacheDependency sqc; - AssertExtensions.Throws<HttpException> (() => { + Assert.Throws<HttpException> (() => { sqc = SqlCacheDependency.CreateOutputCacheDependency (null); }, "#A1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { sqc = SqlCacheDependency.CreateOutputCacheDependency (String.Empty); }, "#A2"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { sqc = SqlCacheDependency.CreateOutputCacheDependency ("Database"); }, "#A2"); diff --git a/mcs/class/System.Web/Test/System.Web.Caching/SubstitutionResponseElementTest.cs b/mcs/class/System.Web/Test/System.Web.Caching/SubstitutionResponseElementTest.cs index 64a32af27ba..b267e8a03ad 100644 --- a/mcs/class/System.Web/Test/System.Web.Caching/SubstitutionResponseElementTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Caching/SubstitutionResponseElementTest.cs @@ -33,7 +33,6 @@ using System.Web; using System.Web.Caching; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.Caching { @@ -50,7 +49,7 @@ namespace MonoTests.System.Web.Caching { SubstitutionResponseElement sre; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { sre = new SubstitutionResponseElement (null); }, "#A1"); diff --git a/mcs/class/System.Web/Test/System.Web.Compilation/BuildManagerTest.cs b/mcs/class/System.Web/Test/System.Web.Compilation/BuildManagerTest.cs index 28de9a7623f..a4f73590c0b 100644 --- a/mcs/class/System.Web/Test/System.Web.Compilation/BuildManagerTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Compilation/BuildManagerTest.cs @@ -33,7 +33,7 @@ using System.Web.Compilation; using System.Web.Hosting; using NUnit.Framework; -using MonoTests.Common; + namespace MonoTests.System.Web.Compilation { @@ -45,7 +45,7 @@ namespace MonoTests.System.Web.Compilation [Ignore ("Pending investigation if it is indeed the correct test.")] public void GetGlobalAsaxType () { - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { BuildManager.GetGlobalAsaxType (); }, "#A1"); } diff --git a/mcs/class/System.Web/Test/System.Web.Compilation/BuildProviderTest.cs b/mcs/class/System.Web/Test/System.Web.Compilation/BuildProviderTest.cs index 852b3773c95..fd15a3b2930 100644 --- a/mcs/class/System.Web/Test/System.Web.Compilation/BuildProviderTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Compilation/BuildProviderTest.cs @@ -39,7 +39,6 @@ using NUnit.Framework; using MonoTests.SystemWeb.Framework; using MonoTests.stand_alone.WebHarness; -using MonoTests.Common; namespace MonoTests.System.Web.Compilation { @@ -49,25 +48,25 @@ namespace MonoTests.System.Web.Compilation [Test] public void RegisterBuildProvider () { - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { BuildProvider.RegisterBuildProvider (null, typeof (FooBuildProvider)); }, "#A1-1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { BuildProvider.RegisterBuildProvider (String.Empty, typeof (FooBuildProvider)); }, "#A1-2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { BuildProvider.RegisterBuildProvider (".foo", null); }, "#A1-3"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { BuildProvider.RegisterBuildProvider (".foo", typeof (string)); }, "#A1-4"); // This would have worked if we called the method during the pre-application start stage // (we have a test for this in the standalone test suite) - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { BuildProvider.RegisterBuildProvider (".foo", typeof (BuildProvider)); }, "#A1-5"); } diff --git a/mcs/class/System.Web/Test/System.Web.Compilation/RouteUrlExpressionBuilderTest.cs b/mcs/class/System.Web/Test/System.Web.Compilation/RouteUrlExpressionBuilderTest.cs index 68a97a2e7e4..d1369eb2c67 100644 --- a/mcs/class/System.Web/Test/System.Web.Compilation/RouteUrlExpressionBuilderTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Compilation/RouteUrlExpressionBuilderTest.cs @@ -39,7 +39,7 @@ using NUnit.Framework; using MonoTests.SystemWeb.Framework; using MonoTests.stand_alone.WebHarness; -using MonoTests.Common; + namespace MonoTests.System.Web.Compilation { @@ -84,11 +84,11 @@ namespace MonoTests.System.Web.Compilation obj = bldr.EvaluateExpression (null, entry, null, context); Assert.IsNull (obj, "#A4"); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { bldr.EvaluateExpression (null, null, null, context); }, "#A5-1"); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { bldr.EvaluateExpression (null, entry, null, null); }, "#A5-2"); } @@ -105,7 +105,7 @@ namespace MonoTests.System.Web.Compilation [Test] public void GetRouteUrl () { - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { RouteUrlExpressionBuilder.GetRouteUrl (null, "bar=test"); }, "#A1-1"); @@ -139,15 +139,15 @@ namespace MonoTests.System.Web.Compilation Assert.IsNotNull (url, "#A6-1"); Assert.AreEqual ("/NunitWeb/test-foo", url, "#A6-2"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { url = RouteUrlExpressionBuilder.GetRouteUrl (new Control (), "routename"); }, "#A7-1"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { url = RouteUrlExpressionBuilder.GetRouteUrl (new Control (), String.Empty); }, "#A7-2"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { url = RouteUrlExpressionBuilder.GetRouteUrl (new Control (), null); }, "#A7-2"); } @@ -165,7 +165,7 @@ namespace MonoTests.System.Web.Compilation Assert.AreEqual (1, rvd.Count, "#A1-4-1"); Assert.AreEqual (String.Empty, rvd ["route"], "#A1-4-2"); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { RouteUrlExpressionBuilder.TryParseRouteExpression ("foo=bar", null, out routeName); }, "#A1-5"); @@ -235,7 +235,7 @@ namespace MonoTests.System.Web.Compilation var context = new ExpressionBuilderContext (new FakePage ()); CodeExpression expr; - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { expr = bldr.GetCodeExpression (null, "data", context); }, "#A1-1"); diff --git a/mcs/class/System.Web/Test/System.Web.Security/MachineKeyTest.cs b/mcs/class/System.Web/Test/System.Web.Security/MachineKeyTest.cs index a88bfa88c0e..062a0f4bef0 100644 --- a/mcs/class/System.Web/Test/System.Web.Security/MachineKeyTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Security/MachineKeyTest.cs @@ -32,7 +32,6 @@ using System; using System.Text; using System.Web.Security; -using MonoTests.Common; using NUnit.Framework; namespace MonoTests.System.Web.Security @@ -53,7 +52,7 @@ namespace MonoTests.System.Web.Security #endif const int VALIDATION_EXPECTED_SIZE = 64; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { MachineKey.Encode (null, MachineKeyProtection.All); }, "#A1-1"); @@ -79,11 +78,11 @@ namespace MonoTests.System.Web.Security { byte[] decoded; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { MachineKey.Decode (null, MachineKeyProtection.All); }, "#A1-1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { decoded = MachineKey.Decode (String.Empty, MachineKeyProtection.All); }, "#A1-2"); @@ -107,15 +106,15 @@ namespace MonoTests.System.Web.Security Assert.IsNotNull (decoded, "#A5-1"); Assert.AreEqual (5, decoded.Length, "#A5-2"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { decoded = MachineKey.Decode ("test", MachineKeyProtection.All); }, "#B1-1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { decoded = MachineKey.Decode ("test", MachineKeyProtection.Encryption); }, "#B1-2"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { decoded = MachineKey.Decode ("test", MachineKeyProtection.Validation); }, "#B1-3"); @@ -172,11 +171,11 @@ namespace MonoTests.System.Web.Security [Test] public void Protect () { - AssertExtensions.Throws<ArgumentNullException> (() => + Assert.Throws<ArgumentNullException> (() => MachineKey.Protect (null, null), "MachineKey.Protect not throwing an ArgumentNullException"); - AssertExtensions.Throws<ArgumentNullException> (() => + Assert.Throws<ArgumentNullException> (() => MachineKey.Protect (null, new [] { "test" }), "MachineKey.Protect not throwing an ArgumentNullException"); @@ -191,11 +190,11 @@ namespace MonoTests.System.Web.Security Assert.AreEqual (plainBytes, validDecryptedBytes, "Decryption didn't work"); - AssertExtensions.Throws<CryptographicException> (() => + Assert.Throws<CryptographicException> (() => MachineKey.Unprotect (encryptedBytes, invalidUsages), "Purposes not encrypting properly"); - AssertExtensions.Throws<CryptographicException> (() => + Assert.Throws<CryptographicException> (() => MachineKey.Unprotect (encryptedBytes, oneUsage), "Single purpose working when multiple supplied"); } diff --git a/mcs/class/System.Web/Test/System.Web.Security/MembershipTest.cs b/mcs/class/System.Web/Test/System.Web.Security/MembershipTest.cs index 6169a23520b..ab8abdf105e 100644 --- a/mcs/class/System.Web/Test/System.Web.Security/MembershipTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Security/MembershipTest.cs @@ -32,7 +32,6 @@ using System.Text; using System.Web.Security; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.Security { @@ -70,19 +69,19 @@ namespace MonoTests.System.Web.Security { { MembershipUser user; - AssertExtensions.Throws<MembershipCreateUserException> (() => { + Assert.Throws<MembershipCreateUserException> (() => { user = Membership.CreateUser (null, "password"); }, "#A1"); - AssertExtensions.Throws<MembershipCreateUserException> (() => { + Assert.Throws<MembershipCreateUserException> (() => { user = Membership.CreateUser (String.Empty, "password"); }, "#A2"); - AssertExtensions.Throws<MembershipCreateUserException> (() => { + Assert.Throws<MembershipCreateUserException> (() => { user = Membership.CreateUser ("user", null); }, "#B1"); - AssertExtensions.Throws<MembershipCreateUserException> (() => { + Assert.Throws<MembershipCreateUserException> (() => { user = Membership.CreateUser ("user", String.Empty); }, "#B2"); } diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs index 4fc1f75f851..c73f11d0e3b 100644 --- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangePasswordTest.cs @@ -40,7 +40,6 @@ using System.Web.Security; using System.Text.RegularExpressions; using MonoTests.SystemWeb.Framework; using MonoTests.stand_alone.WebHarness; -using MonoTests.Common; using NUnit.Framework; using System.Collections.Specialized; @@ -879,7 +878,7 @@ namespace MonoTests.System.Web.UI.WebControls using (var sw = new StringWriter ()) { using (var w = new HtmlTextWriter (sw)) { if (shouldFail) - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { cp.RenderControl (w); }, message); else { diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/DataListTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/DataListTest.cs index 9e61762f001..bd56446b65e 100644 --- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/DataListTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/DataListTest.cs @@ -38,7 +38,6 @@ using System.Web.UI; using System.Web.UI.WebControls; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.UI.WebControls { @@ -327,11 +326,11 @@ namespace MonoTests.System.Web.UI.WebControls { { TestDataList dl = new TestDataList (); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { dl.RepeatLayout = RepeatLayout.OrderedList; }, "#A1"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { dl.RepeatLayout = RepeatLayout.UnorderedList; }, "#A2"); } diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/MasterPageTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/MasterPageTest.cs index 02fc8537059..33df3634b1a 100644 --- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/MasterPageTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/MasterPageTest.cs @@ -42,7 +42,6 @@ using System.Collections; using MonoTests.SystemWeb.Framework; using MonoTests.stand_alone.WebHarness; using System.Threading; -using MonoTests.Common; namespace MonoTests.System.Web.UI.WebControls { @@ -219,17 +218,17 @@ namespace MonoTests.System.Web.UI.WebControls var mp = new MasterPage (); ITemplate template = new MyTemplate (); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (null, template); }, "#A1-1"); Control container = new Control (); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (container, null); }, "#A1-2"); #if DOTNET // TODO: why does it throw? Unchecked 'as' type cast? - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (container, template); }, "#B1-1"); #endif @@ -257,12 +256,12 @@ namespace MonoTests.System.Web.UI.WebControls ITemplate template = new MyTemplate (); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (null, template); }, "#A1-1"); Control container = new Control (); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (container, null); }, "#A1-2"); diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/MenuTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/MenuTest.cs index 868e447a276..21f84371d96 100644 --- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/MenuTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/MenuTest.cs @@ -47,8 +47,6 @@ using System.Text.RegularExpressions; using System.Reflection; using System.Xml; -using MonoTests.Common; - namespace MonoTests.System.Web.UI.WebControls { class MenuTable : Menu @@ -1774,11 +1772,11 @@ namespace MonoTests.System.Web.UI.WebControls maxValue = value; } - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { m.RenderingMode = (MenuRenderingMode) (minValue - 1); }, "#A2-1"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { m.RenderingMode = (MenuRenderingMode) (maxValue + 1); }, "#A2-2"); } diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/RouteParameterTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/RouteParameterTest.cs index eec1e9bc2c2..fc3959c0c49 100644 --- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/RouteParameterTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/RouteParameterTest.cs @@ -31,7 +31,6 @@ using System.Web.UI; using System.Web.UI.WebControls; using NUnit.Framework; -using MonoTests.Common; using MonoTests.System.Web; namespace MonoTests.System.Web.UI.WebControls @@ -60,7 +59,7 @@ namespace MonoTests.System.Web.UI.WebControls RouteParameter rp; RouteParameter original; - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { rp = new FakeRouteParameter ((RouteParameter) null); }, "#A1"); @@ -137,7 +136,7 @@ namespace MonoTests.System.Web.UI.WebControls Assert.IsNull (rp.DoEvaluate (null, new Control ()), "#A1-1"); Assert.IsNull (rp.DoEvaluate (ctx, null), "#A1-2"); - AssertExtensions.Throws <NullReferenceException> (() => { + Assert.Throws <NullReferenceException> (() => { rp.DoEvaluate (ctx, new Control ()); }, "#A1-2"); } diff --git a/mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardTest.cs b/mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardTest.cs index df2d7118b2b..b4e3f992b6b 100755 --- a/mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardTest.cs @@ -46,9 +46,6 @@ using MonoTests.SystemWeb.Framework; using MonoTests.stand_alone.WebHarness; using System.Threading; -using MonoTests.Common; - - namespace MonoTests.System.Web.UI.WebControls { @@ -1501,7 +1498,7 @@ namespace MonoTests.System.Web.UI.WebControls t.UserData = "Empty"; string result; - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { result = t.Run (); }, "#A1"); } @@ -1517,7 +1514,7 @@ namespace MonoTests.System.Web.UI.WebControls Assert.AreEqual (String.Empty, renderedHtml, "#A1"); t.UserData = "OptionalSideBar_WithSideBar"; - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { result = t.Run (); }, "#A2"); } @@ -1552,7 +1549,7 @@ namespace MonoTests.System.Web.UI.WebControls Assert.AreEqual (String.Empty, renderedHtml, "#A1"); t.UserData = "OptionalHeader_WithHeaderTemplate"; - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { result = t.Run (); }, "#A2"); } @@ -1580,7 +1577,7 @@ namespace MonoTests.System.Web.UI.WebControls { WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender)); t.UserData = "StepPlaceHolder"; - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { string result = t.Run (); }, "#A1"); } @@ -1590,7 +1587,7 @@ namespace MonoTests.System.Web.UI.WebControls { WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender)); t.UserData = "NavigationPlaceHolder"; - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { string result = t.Run (); }, "#A1"); } diff --git a/mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs b/mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs index 604365e428e..3d4451ab9e8 100644 --- a/mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs @@ -40,7 +40,6 @@ using System.Web.UI; using System.Web.UI.WebControls; using MonoTests.SystemWeb.Framework; using MonoTests.stand_alone.WebHarness; -using MonoTests.Common; using System.Web.UI.Adapters; @@ -1059,7 +1058,7 @@ namespace MonoTests.System.Web.UI var ctl = new Control (); object obj = new { foo = "one", bar = "two" }; string path; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { path = ctl.GetRouteUrl ("myroute1", obj); }, "#A1"); @@ -1090,7 +1089,7 @@ namespace MonoTests.System.Web.UI {"bar", "two"} }; string path; - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { path = ctl.GetRouteUrl ("myroute", rvd); }, "#A1"); diff --git a/mcs/class/System.Web/Test/System.Web.UI/DataSourceCacheDurationConverterTest.cs b/mcs/class/System.Web/Test/System.Web.UI/DataSourceCacheDurationConverterTest.cs index 37ea277df8b..efdb5a5ea67 100644 --- a/mcs/class/System.Web/Test/System.Web.UI/DataSourceCacheDurationConverterTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI/DataSourceCacheDurationConverterTest.cs @@ -32,7 +32,6 @@ using System.Text; using System.Web.UI; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.UI { @@ -76,7 +75,7 @@ namespace MonoTests.System.Web.UI Assert.AreEqual (0, cvt.ConvertFrom (null, null, String.Empty), "#A1-2"); Assert.AreEqual (0, cvt.ConvertFrom (null, null, "infinite"), "#A1-3"); Assert.AreEqual (0, cvt.ConvertFrom (null, null, "INfINiTE"), "#A1-4"); - AssertExtensions.Throws<Exception> (() => { + Assert.Throws<Exception> (() => { cvt.ConvertFrom (null, null, "dummy"); }, "#A1-5"); Assert.AreEqual (5, cvt.ConvertFrom (null, null, "5"), "#A1-6"); diff --git a/mcs/class/System.Web/Test/System.Web.UI/MinimizableAttributeTypeConverterTest.cs b/mcs/class/System.Web/Test/System.Web.UI/MinimizableAttributeTypeConverterTest.cs index 8dff094c30d..677d0dfd74c 100644 --- a/mcs/class/System.Web/Test/System.Web.UI/MinimizableAttributeTypeConverterTest.cs +++ b/mcs/class/System.Web/Test/System.Web.UI/MinimizableAttributeTypeConverterTest.cs @@ -37,8 +37,6 @@ using System.Web.UI.HtmlControls; using System.Reflection; using NUnit.Framework; -using MonoTests.Common; - namespace MonoTests.System.Web.UI { [TestFixture] @@ -101,16 +99,16 @@ namespace MonoTests.System.Web.UI { Assert.AreEqual (false, tc.ConvertFrom (null, culture, "FALSE"), "A5"); Assert.AreEqual (true, tc.ConvertFrom (null, culture, "true"), "A6"); Assert.AreEqual (true, tc.ConvertFrom (null, culture, "True"), "A"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { tc.ConvertFrom (null, culture, true); }, "A8"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { tc.ConvertFrom (null, culture, false); }, "A9"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { tc.ConvertFrom (null, culture, 1234); }, "A10"); - AssertExtensions.Throws<NotSupportedException> (() => { + Assert.Throws<NotSupportedException> (() => { tc.ConvertFrom (null, culture, null); }, "A11"); } diff --git a/mcs/class/System.Web/Test/System.Web.Util/HttpEncoderTest.cs b/mcs/class/System.Web/Test/System.Web.Util/HttpEncoderTest.cs index 4ea7ad9ab5a..58269e6fc18 100644 --- a/mcs/class/System.Web/Test/System.Web.Util/HttpEncoderTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Util/HttpEncoderTest.cs @@ -34,7 +34,6 @@ using NUnit.Framework; using MonoTests.SystemWeb.Framework; using MonoTests.stand_alone.WebHarness; -using MonoTests.Common; namespace MonoTests.System.Web.Util { @@ -83,7 +82,7 @@ namespace MonoTests.System.Web.Util var encoder = new HttpEncoderPoker (); var sw = new StringWriter (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { encoder.CallHtmlAttributeEncode ("string", null); }, "#A1"); @@ -117,7 +116,7 @@ namespace MonoTests.System.Web.Util var encoder = new HttpEncoderPoker (); StringWriter sw; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { encoder.CallHtmlDecode ("string", null); }, "#A1"); @@ -152,7 +151,7 @@ namespace MonoTests.System.Web.Util var encoder = new HttpEncoderPoker (); StringWriter sw; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { encoder.CallHtmlEncode ("string", null); }, "#A1"); @@ -177,23 +176,23 @@ namespace MonoTests.System.Web.Util var encoder = new HttpEncoderPoker (); byte [] bytes = new byte [10]; - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { encoder.CallUrlEncode (bytes, -1, 1); }, "#A1-1"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { encoder.CallUrlEncode (bytes, 11, 1); }, "#A1-2"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { encoder.CallUrlEncode (bytes, 0, -1); }, "#A1-3"); - AssertExtensions.Throws<ArgumentOutOfRangeException> (() => { + Assert.Throws<ArgumentOutOfRangeException> (() => { encoder.CallUrlEncode (bytes, 01, 11); }, "#A1-4"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { encoder.CallUrlEncode (null, 0, 1); }, "#A1-5"); diff --git a/mcs/class/System.Web/Test/System.Web.Util/RequestValidatorTest.cs b/mcs/class/System.Web/Test/System.Web.Util/RequestValidatorTest.cs index b185d1290fd..cb464415c44 100644 --- a/mcs/class/System.Web/Test/System.Web.Util/RequestValidatorTest.cs +++ b/mcs/class/System.Web/Test/System.Web.Util/RequestValidatorTest.cs @@ -33,7 +33,6 @@ using System.Web.Caching; using System.Web.Util; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web.Util { @@ -74,7 +73,7 @@ namespace MonoTests.System.Web.Util { Assert.IsNotNull (RequestValidator.Current, "#A1"); Assert.AreEqual (typeof (RequestValidator).AssemblyQualifiedName, RequestValidator.Current.GetType ().AssemblyQualifiedName, "#A2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { RequestValidator.Current = null; }, "#A3"); diff --git a/mcs/class/System.Web/Test/System.Web/HttpApplicationTest.cs b/mcs/class/System.Web/Test/System.Web/HttpApplicationTest.cs index 7d572081fcd..e20e8d38d03 100644 --- a/mcs/class/System.Web/Test/System.Web/HttpApplicationTest.cs +++ b/mcs/class/System.Web/Test/System.Web/HttpApplicationTest.cs @@ -30,7 +30,6 @@ using System.Web; using System.Web.Caching; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web { diff --git a/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs b/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs index 15d1f137a0a..117648b6e8e 100644 --- a/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs +++ b/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs @@ -38,8 +38,6 @@ using System.IO; using System.Threading; using System.Globalization; -using MonoTests.Common; - namespace MonoTests.System.Web { [TestFixture] @@ -204,21 +202,21 @@ namespace MonoTests.System.Web { Assert.AreEqual (Path.Combine (appBase, "DIR" + Path.DirectorySeparatorChar + "Web.config"), r.MapPath ("Web.config", "~/DIR", false), "test11"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // Throws because the test's virtual dir is /NunitWeb and / is above it r.MapPath ("/test.txt"); }, "test12"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { // Throws because the test's virtual dir is /NunitWeb and /NunitWeb1 does not match it r.MapPath ("/NunitWeb1/test.txt"); }, "test13"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { r.MapPath ("/test.txt", "/", false); }, "test14"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { r.MapPath ("/test.txt", "/NunitWeb", false); }, "test15"); diff --git a/mcs/class/System.Web/Test/System.Web/HttpResponseTest.cs b/mcs/class/System.Web/Test/System.Web/HttpResponseTest.cs index 0342a707978..8b24201cd91 100644 --- a/mcs/class/System.Web/Test/System.Web/HttpResponseTest.cs +++ b/mcs/class/System.Web/Test/System.Web/HttpResponseTest.cs @@ -38,8 +38,6 @@ using System.Web.Caching; using NUnit.Framework; -using MonoTests.Common; - namespace MonoTests.System.Web { public class FakeHttpWorkerRequest2 : HttpWorkerRequest { @@ -637,19 +635,19 @@ namespace MonoTests.System.Web { { FakeHttpWorkerRequest2 request; HttpContext context = Cook (1, out request); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { context.Response.RedirectPermanent (null); }, "#A1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { context.Response.RedirectPermanent ("http://invalid\nurl.com"); }, "#A2"); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { context.Response.RedirectPermanent (null, true); }, "#A3"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { context.Response.RedirectPermanent ("http://invalid\nurl.com", true); }, "#A4"); } @@ -659,7 +657,7 @@ namespace MonoTests.System.Web { { var resp = new HttpResponse (new StringWriter ()); // Ho, ho, ho! - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { resp.RedirectToRoute ("SomeRoute"); }, "#A1"); @@ -667,11 +665,11 @@ namespace MonoTests.System.Web { HttpContext context = Cook (1, out request); // From RouteCollection.GetVirtualPath - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { context.Response.RedirectToRoute ("SomeRoute"); }, "#A2"); - AssertExtensions.Throws<InvalidOperationException> (() => { + Assert.Throws<InvalidOperationException> (() => { context.Response.RedirectToRoute (new { productId = "1", category = "widgets" }); }, "#A3"); } @@ -679,22 +677,22 @@ namespace MonoTests.System.Web { [Test] public void RemoveOutputCacheItem () { - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { HttpResponse.RemoveOutputCacheItem (null, "MyProvider"); }, "#A1"); - AssertExtensions.Throws<ArgumentException> (() => { + Assert.Throws<ArgumentException> (() => { HttpResponse.RemoveOutputCacheItem ("badPath", null); }, "#A2"); Assert.IsNull (OutputCache.Providers, "#A3"); HttpResponse.RemoveOutputCacheItem ("/Path", null); - AssertExtensions.Throws<ProviderException> (() => { + Assert.Throws<ProviderException> (() => { HttpResponse.RemoveOutputCacheItem ("/Path", String.Empty); }, "#A3"); - AssertExtensions.Throws<ProviderException> (() => { + Assert.Throws<ProviderException> (() => { HttpResponse.RemoveOutputCacheItem ("/Path", "MyProvider"); }, "#A4"); } @@ -710,23 +708,23 @@ namespace MonoTests.System.Web { Assert.IsNull (context.Response.Output, "#A2"); // Classy... - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { context.Response.Write ('t'); }, "#A3-1"); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { context.Response.Write ((object) 5); }, "#A3-2"); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { context.Response.Write ("string"); }, "#A3-3"); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { context.Response.Write (new char [] { '1' }, 0, 1); }, "#A3-4"); - AssertExtensions.Throws<NullReferenceException> (() => { + Assert.Throws<NullReferenceException> (() => { context.Response.Write ((object) null); }, "#A3-5"); } diff --git a/mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs b/mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs index d320a54f1f0..10736a82b88 100644 --- a/mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs +++ b/mcs/class/System.Web/Test/System.Web/HttpUtilityTest.cs @@ -33,7 +33,6 @@ using System.IO; using System.Collections.Specialized; using NUnit.Framework; -using MonoTests.Common; namespace MonoTests.System.Web { @@ -55,7 +54,7 @@ namespace MonoTests.System.Web { public void HtmlAttributeEncode_String_TextWriter () { var sw = new StringWriter (); - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { HttpUtility.HtmlAttributeEncode ("string", null); }, "#A1"); @@ -96,7 +95,7 @@ namespace MonoTests.System.Web { public void HtmlDecode_String_TextWriter () { StringWriter sw; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { HttpUtility.HtmlDecode ("string", null); }, "#A1"); @@ -237,7 +236,7 @@ namespace MonoTests.System.Web { public void HtmlEncode_2 () { StringWriter sw; - AssertExtensions.Throws<ArgumentNullException> (() => { + Assert.Throws<ArgumentNullException> (() => { HttpUtility.HtmlEncode ("string", null); }, "#A1"); diff --git a/mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs b/mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs index c168a31e426..86a7fb3547e 100644 --- a/mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs +++ b/mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs @@ -8,7 +8,6 @@ using NUnit.Framework; using System; -using MonoTests.Common; using System.Globalization; using System.Runtime.CompilerServices; using System.Threading; @@ -149,7 +148,7 @@ namespace MonoTests.System Assert.AreEqual(1, Decimal.ToByte(1)); Assert.AreEqual(255, Decimal.ToByte(255)); - AssertExtensions.Throws<OverflowException>(() => Decimal.ToByte(256), "Expected an overflow"); + Assert.Throws<OverflowException>(() => Decimal.ToByte(256), "Expected an overflow"); } private void VerifyAdd<T>(Decimal d1, Decimal d2, Decimal expected = Decimal.Zero) where T : Exception @@ -698,7 +697,7 @@ namespace MonoTests.System Assert.IsTrue(d.CompareTo(247m) > 0); Assert.IsTrue(d.CompareTo(null) > 0); - AssertExtensions.Throws<ArgumentException>(() => d.CompareTo("248"), "Expected an argument exception"); + Assert.Throws<ArgumentException>(() => d.CompareTo("248"), "Expected an argument exception"); } [Test] diff --git a/mcs/class/corlib/corlib_test.dll.sources b/mcs/class/corlib/corlib_test.dll.sources index 3bfb14439cb..f91fcfee2e1 100644 --- a/mcs/class/corlib/corlib_test.dll.sources +++ b/mcs/class/corlib/corlib_test.dll.sources @@ -1,7 +1,6 @@ Microsoft.Win32/RegistryKeyTest.cs Mono/DataConvertTest.cs ../Mono/DataConverter.cs -../../System.Runtime.Caching/Test/Common/AssertExtensions.cs System/ActivatorTest.cs System/AppDomainManagerTest.cs System/AppDomainSetupTest.cs |