From: Choy R. <ch...@us...> - 2005-01-29 08:49:22
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9962/DotNetMock Modified Files: Tag: RFE_1098585 Assertion.cs DotNetMock.csproj Log Message: Moved the ITestFramework implementation resolution policy/algorithm into the DotNetMock.TestFramework namespace. Keep it separate and testable. Index: Assertion.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Assertion.cs,v retrieving revision 1.5.4.3 retrieving revision 1.5.4.4 diff -C2 -d -r1.5.4.3 -r1.5.4.4 *** Assertion.cs 26 Jan 2005 01:36:41 -0000 1.5.4.3 --- Assertion.cs 29 Jan 2005 08:49:12 -0000 1.5.4.4 *************** *** 4,14 **** #region Imports using System; - using System.Configuration; - using System.IO; - using System.Reflection; - using System.Runtime.Remoting; using DotNetMock.Core; - using DotNetMock.TestFramework; #endregion --- 4,9 ---- *************** *** 30,79 **** /// Private variable to hold concrete instance of ITestFramework interface. /// </summary> ! private static ITestFramework _testFramework = null; ! /// <summary> ! /// Static type initializer. Creates instance for ITestFramework from configuration file setup. ! /// If no configuration information is specified, defaults to NUnit. ! /// </summary> ! static Assertion() ! { ! string iTestFrameworkComponent = Environment.GetEnvironmentVariable("DotNetMock_TestingComponent"); ! string iTestFrameworkAssembly = Environment.GetEnvironmentVariable("DotNetMock_TestingAssembly"); ! ! if ( ( iTestFrameworkAssembly == null ) || ( iTestFrameworkAssembly.Equals( String.Empty ) ) ) ! { ! StubClassMaker classMaker = new StubClassMaker(); ! IStubMaker stubMaker = null; ! Assembly providerAssembly = null; ! if ( (providerAssembly = TryToLoadAssembly("nunit.framework"))!=null ) ! { ! stubMaker = new NUnitStubMaker(providerAssembly); ! } ! else if ( (providerAssembly = TryToLoadAssembly("MbUnit.Core"))!=null ) ! { ! stubMaker = new MbUnitStubMaker(providerAssembly); ! } ! else if ( (providerAssembly = TryToLoadAssembly("csUnit"))!=null ) ! { ! stubMaker = new csUnitStubMaker(providerAssembly); ! } ! if ( stubMaker==null ) ! { ! throw new InvalidOperationException( ! "Cannot find a testing framework" ! ); ! } ! Type stubClass = classMaker.MakeStubClass( ! typeof(ITestFramework), ! stubMaker ! ); ! _testFramework = (ITestFramework) ! Activator.CreateInstance(stubClass); ! } ! else ! { ! ObjectHandle concreteObject = Activator.CreateInstance( iTestFrameworkAssembly, iTestFrameworkComponent ); ! _testFramework = (ITestFramework)concreteObject.Unwrap(); ! } ! } /// <summary> /// Asserts that two objects are equal. If the objects are not equal the assertions fails with the --- 25,31 ---- /// Private variable to hold concrete instance of ITestFramework interface. /// </summary> ! private static ITestFramework _testFramework = ! DotNetMock.TestFramework.Implementation.Instance; ! /// <summary> /// Asserts that two objects are equal. If the objects are not equal the assertions fails with the *************** *** 218,233 **** } } - - private static Assembly TryToLoadAssembly(string assemblyName) - { - try - { - return Assembly.LoadWithPartialName(assemblyName); - } - catch (FileNotFoundException) - { - return null; - } - } } } --- 170,173 ---- Index: DotNetMock.csproj =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/DotNetMock.csproj,v retrieving revision 1.30.2.2 retrieving revision 1.30.2.3 diff -C2 -d -r1.30.2.2 -r1.30.2.3 *** DotNetMock.csproj 26 Jan 2005 01:24:56 -0000 1.30.2.2 --- DotNetMock.csproj 29 Jan 2005 08:49:12 -0000 1.30.2.3 *************** *** 360,363 **** --- 360,378 ---- /> <File + RelPath = "TestFramework\IDynamicLinker.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TestFramework\Implementation.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TestFramework\ImplementationFactory.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TestFramework\IStubMaker.cs" SubType = "Code" *************** *** 379,382 **** --- 394,402 ---- BuildAction = "Compile" /> + <File + RelPath = "TestFramework\SystemDynamicLinker.cs" + SubType = "Code" + BuildAction = "Compile" + /> </Include> </Files> |