[Adapdev-commits] Adapdev/src/Adapdev.UnitTest Adapdev.UnitTest.csproj.user,1.2,1.3 Assert.cs,1.1.1.
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2005-10-21 04:59:37
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27500/src/Adapdev.UnitTest Modified Files: Assert.cs Added Files: Adapdev.UnitTest.csproj.user Log Message: Several bug fixes for AbstractDAO Added unit tests for NUnit support Index: Assert.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest/Assert.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Assert.cs 28 Feb 2005 01:32:18 -0000 1.1.1.1 --- Assert.cs 21 Oct 2005 04:59:20 -0000 1.2 *************** *** 484,487 **** --- 484,537 ---- } + + #region AreNotEqual + + /// <summary> + /// Asserts that two objects are not equal. If they are equal + /// an <see cref="AssertionException"/> is thrown. + /// </summary> + /// <param name="expected">The expected object</param> + /// <param name="actual">The actual object</param> + /// <param name="message">The message to be printed when the two objects are the same object.</param> + /// <param name="args">Arguments to be used in formatting the message</param> + static public void AreNotEqual( Object expected, Object actual, string message, params object[] args) + { + if ( expected == null && actual == null ) Fail(); + if ( expected == null || actual == null ) return; + + if ( expected.GetType().IsArray && actual.GetType().IsArray ) + { + if ( ArraysEqual( (Array)expected, (Array)actual ) ) + Fail(); + } + else if ( ObjectsEqual( expected, actual ) ) + Fail(); + } + + /// <summary> + /// Asserts that two objects are not equal. If they are equal + /// an <see cref="AssertionException"/> is thrown. + /// </summary> + /// <param name="expected">The expected object</param> + /// <param name="actual">The actual object</param> + /// <param name="message">The message to be printed when the objects are the same</param> + static public void AreNotEqual(Object expected, Object actual, string message) + { + Assert.AreNotEqual(expected, actual, message, null); + } + + /// <summary> + /// Asserts that two objects are not equal. If they are equal + /// an <see cref="AssertionException"/> is thrown. + /// </summary> + /// <param name="expected">The expected object</param> + /// <param name="actual">The actual object</param> + static public void AreNotEqual(Object expected, Object actual) + { + Assert.AreNotEqual(expected, actual, string.Empty, null); + } + + #endregion + /// <summary> /// The Equals method throws an AssertionException. This is done *************** *** 813,816 **** --- 863,886 ---- Assert.Fail(formatted+"expected same"); } + + + private static bool ArraysEqual( Array expected, Array actual ) + { + if ( expected.Rank != actual.Rank ) + return false; + + if ( expected.Rank != 1 ) + throw new ArgumentException( "Multi-dimension array comparison is not supported" ); + + int iLength = Math.Min( expected.Length, actual.Length ); + for( int i = 0; i < iLength; i++ ) + if ( !ObjectsEqual( expected.GetValue( i ), actual.GetValue( i ) ) ) + return false; + + if ( expected.Length != actual.Length ) + return false; + + return true; + } } } \ No newline at end of file --- NEW FILE: Adapdev.UnitTest.csproj.user --- <VisualStudioProject> <CSHARP LastOpenVersion = "7.10.3077" > <Build> <Settings ReferencePath = "D:\projects\Adapdev\Adapdev\lib\" > <Config Name = "Debug" EnableASPDebugging = "false" EnableASPXDebugging = "false" EnableUnmanagedDebugging = "false" EnableSQLServerDebugging = "false" RemoteDebugEnabled = "false" RemoteDebugMachine = "" StartAction = "Project" StartArguments = "" StartPage = "" StartProgram = "" StartURL = "" StartWorkingDirectory = "" StartWithIE = "false" /> <Config Name = "Release" EnableASPDebugging = "false" EnableASPXDebugging = "false" EnableUnmanagedDebugging = "false" EnableSQLServerDebugging = "false" RemoteDebugEnabled = "false" RemoteDebugMachine = "" StartAction = "Project" StartArguments = "" StartPage = "" StartProgram = "" StartURL = "" StartWorkingDirectory = "" StartWithIE = "false" /> </Settings> </Build> <OtherProjectSettings CopyProjectDestinationFolder = "" CopyProjectUncPath = "" CopyProjectOption = "0" ProjectView = "ProjectFiles" ProjectTrust = "0" /> </CSHARP> </VisualStudioProject> |