← Back to team overview

nunit-core team mailing list archive

[Merge] lp:~saidout/nunit-3.0/compiler-warning-free2 into lp:nunit-3.0

 

Said Outgajjouft has proposed merging lp:~saidout/nunit-3.0/compiler-warning-free2 into lp:nunit-3.0.

Requested reviews:
  NUnit Core Developers (nunit-core)

For more details, see:
https://code.launchpad.net/~saidout/nunit-3.0/compiler-warning-free2/+merge/61476

Compiling a .NET Framework 2.0 build using VS 2010 should now be warning free.
-- 
https://code.launchpad.net/~saidout/nunit-3.0/compiler-warning-free2/+merge/61476
Your team NUnit Core Developers is requested to review the proposed merge of lp:~saidout/nunit-3.0/compiler-warning-free2 into lp:nunit-3.0.
=== modified file 'src/framework/AssertionHelper.cs'
--- src/framework/AssertionHelper.cs	2010-08-02 02:42:35 +0000
+++ src/framework/AssertionHelper.cs	2011-05-18 21:01:15 +0000
@@ -19,23 +19,21 @@
 // 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.Collections;
-using NUnit.Framework;
+// ***********************************************************************
+
+using System.Collections;
 using NUnit.Framework.Constraints;
 
 namespace NUnit.Framework
 {
-	/// <summary>
-	/// AssertionHelper is an optional base class for user tests,
-	/// allowing the use of shorter names for constraints and
-	/// asserts and avoiding conflict with the definition of 
-	/// <see cref="Is"/>, from which it inherits much of its
-	/// behavior, in certain mock object frameworks.
-	/// </summary>
-	public class AssertionHelper : ConstraintFactory
+    /// <summary>
+    /// AssertionHelper is an optional base class for user tests,
+    /// allowing the use of shorter names for constraints and
+    /// asserts and avoiding conflict with the definition of 
+    /// <see cref="Is"/>, from which it inherits much of its
+    /// behavior, in certain mock object frameworks.
+    /// </summary>
+    public class AssertionHelper : ConstraintFactory
     {
         #region Assert
         //private Assertions assert = new Assertions();
@@ -51,7 +49,7 @@
         /// <summary>
         /// Apply a constraint to an actual value, succeeding if the constraint
         /// is satisfied and throwing an assertion exception on failure. Works
-        /// identically to <see cref="NUnit.Framework.Assert.That(object, IResolveConstraint)"/>
+        /// identically to <see cref="NUnit.Framework.Assert.That{T}(T, IResolveConstraint)"/>
         /// </summary>
         /// <param name="constraint">A Constraint to be applied</param>
         /// <param name="actual">The actual value to test</param>
@@ -63,7 +61,7 @@
         /// <summary>
         /// Apply a constraint to an actual value, succeeding if the constraint
         /// is satisfied and throwing an assertion exception on failure. Works
-        /// identically to <see cref="NUnit.Framework.Assert.That(object, IResolveConstraint, string)"/>
+        /// identically to <see cref="NUnit.Framework.Assert.That{T}(T, IResolveConstraint, string)"/>
         /// </summary>
         /// <param name="constraint">A Constraint to be applied</param>
         /// <param name="actual">The actual value to test</param>
@@ -76,7 +74,7 @@
         /// <summary>
         /// Apply a constraint to an actual value, succeeding if the constraint
         /// is satisfied and throwing an assertion exception on failure. Works
-        /// identically to <see cref="NUnit.Framework.Assert.That(object, IResolveConstraint, string, object[])"/>
+        /// identically to <see cref="NUnit.Framework.Assert.That{T}(T, IResolveConstraint, string, object[])"/>
         /// </summary>
         /// <param name="constraint">A Constraint to be applied</param>
         /// <param name="actual">The actual value to test</param>
@@ -204,38 +202,38 @@
 
         #region Boolean
         /// <summary>
-		/// Asserts that a condition is true. If the condition is false the method throws
-		/// an <see cref="AssertionException"/>. Works Identically to 
+        /// Asserts that a condition is true. If the condition is false the method throws
+        /// an <see cref="AssertionException"/>. Works Identically to 
         /// <see cref="Assert.That(bool, string, object[])"/>.
-		/// </summary> 
-		/// <param name="condition">The evaluated condition</param>
-		/// <param name="message">The message to display if the condition is false</param>
-		/// <param name="args">Arguments to be used in formatting the message</param>
-		public void Expect(bool condition, string message, params object[] args)
-		{
-			Assert.That(condition, Is.True, message, args);
-		}
+        /// </summary> 
+        /// <param name="condition">The evaluated condition</param>
+        /// <param name="message">The message to display if the condition is false</param>
+        /// <param name="args">Arguments to be used in formatting the message</param>
+        public void Expect(bool condition, string message, params object[] args)
+        {
+            Assert.That(condition, Is.True, message, args);
+        }
 
-		/// <summary>
-		/// Asserts that a condition is true. If the condition is false the method throws
-		/// an <see cref="AssertionException"/>. Works Identically to 
+        /// <summary>
+        /// Asserts that a condition is true. If the condition is false the method throws
+        /// an <see cref="AssertionException"/>. Works Identically to 
         /// <see cref="Assert.That(bool, string)"/>.
-		/// </summary>
-		/// <param name="condition">The evaluated condition</param>
-		/// <param name="message">The message to display if the condition is false</param>
-		public void Expect(bool condition, string message)
-		{
-			Assert.That(condition, Is.True, message, null);
-		}
+        /// </summary>
+        /// <param name="condition">The evaluated condition</param>
+        /// <param name="message">The message to display if the condition is false</param>
+        public void Expect(bool condition, string message)
+        {
+            Assert.That(condition, Is.True, message, null);
+        }
 
-		/// <summary>
-		/// Asserts that a condition is true. If the condition is false the method throws
-		/// an <see cref="AssertionException"/>. Works Identically to <see cref="Assert.That(bool)"/>.
-		/// </summary>
-		/// <param name="condition">The evaluated condition</param>
-		public void Expect(bool condition)
-		{
-			Assert.That(condition, Is.True, null, null);
+        /// <summary>
+        /// Asserts that a condition is true. If the condition is false the method throws
+        /// an <see cref="AssertionException"/>. Works Identically to <see cref="Assert.That(bool)"/>.
+        /// </summary>
+        /// <param name="condition">The evaluated condition</param>
+        public void Expect(bool condition)
+        {
+            Assert.That(condition, Is.True, null, null);
         }
         #endregion
 
@@ -254,14 +252,14 @@
 
         #region Map
         /// <summary>
-		/// Returns a ListMapper based on a collection.
-		/// </summary>
-		/// <param name="original">The original collection</param>
-		/// <returns></returns>
-		public ListMapper Map( ICollection original )
-		{
-			return new ListMapper( original );
-		}
-		#endregion
-	}
+        /// Returns a ListMapper based on a collection.
+        /// </summary>
+        /// <param name="original">The original collection</param>
+        /// <returns></returns>
+        public ListMapper Map( ICollection original )
+        {
+            return new ListMapper( original );
+        }
+        #endregion
+    }
 }

=== modified file 'src/framework/Constraints/StringConstraint.cs'
--- src/framework/Constraints/StringConstraint.cs	2011-04-20 16:40:19 +0000
+++ src/framework/Constraints/StringConstraint.cs	2011-05-18 21:01:15 +0000
@@ -73,6 +73,11 @@
             return Matches((string)actual);
         }
 
+        /// <summary>
+        /// Test whether the constraint is satisfied by a given value
+        /// </summary>
+        /// <param name="actual">The value to be tested</param>
+        /// <returns>True for success, false for failure</returns>
         protected abstract bool Matches(string actual);
-    } 
+    }
 }
\ No newline at end of file

=== modified file 'src/tests/Attributes/TheoryTests.cs'
--- src/tests/Attributes/TheoryTests.cs	2011-04-21 02:09:29 +0000
+++ src/tests/Attributes/TheoryTests.cs	2011-05-18 21:01:15 +0000
@@ -19,13 +19,12 @@
 // 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 NUnit.Framework;
-using NUnit.Framework.Internal;
+// ***********************************************************************
+
+using System;
+using NUnit.Framework.Internal;
+using NUnit.TestData.TheoryFixture;
 using NUnit.TestUtilities;
-using NUnit.TestData.TheoryFixture;
 
 namespace NUnit.Framework.Tests
 {
@@ -59,13 +58,15 @@
             Test test = TestBuilder.MakeTestCase(fixtureType, "TestWithBooleanArguments");
             TestAssert.IsRunnable(test);
             Assert.That(test.TestCaseCount, Is.EqualTo(4));
-        }
+        }
+
+
+        // Ignore warning: this is used as data for NullDatapointIsOk
+        // Do not disable the warning with a pragma or it will not compile under .NET 1.1
+        // Using as operator to assign null in order to disable compiler warning: The field 'NUnit.Framework.Tests.TheoryTests.nullObj' is never used
+        [Datapoint]
+        private object nullObj = new object() as int?;
 
-        [Datapoint]
-        object nullObj; 
-        // Ignore warning: this is used as data for NullDatapointIsOk
-        // Do not disable the warning with a pragma or it will not
-        // compile under .NET 1.1
         [Theory]
         public void NullDatapointIsOK(object o)
         {