locked
Moles abd MbUnit: Moles requires tests to be IN an instrumented process. RRS feed

  • Question

  • I have a simple MbUnit test

    [assembly: MoledType(typeof(DateTime))]

    namespace MyNamespace
    {
        [TestFixture]
        public class MyClass
        {
            [Test, Moled]       
            public void SimpleTestMethod()
            {
                MDateTime.NowGet = () => { return new DateTime(1982, 9, 23); };
            }

     

    Loading the test assembly generated manually through MbUnit gives the following error "Moles requires tests to be IN an instrumented process."

    So I tried loading it through mole.runner.exe

    ---------------------------

    ---------------------------
    System.ApplicationException: Failed Reloading domain ---> System.ApplicationException: Failed loading TestDomain ---> System.Exception: Failed loading assembly ---> Failed loading test assembly

    System.IO.FileLoadException

    Message: Could not load file or assembly 'MyClassTest' or one of its dependencies. Cannot specify assembly evidence under MultiDomain after non-GAC assemblies with default evidence have been loaded in appdomain. (Exception from HRESULT: 0x8013101D)

    Source: mscorlib

    StackTrace:

       at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

       at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

       at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

       at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

       at System.Reflection.Assembly.Load(String assemblyString, Evidence assemblySecurity)

       at MbUnit.Core.Remoting.RemoteTestEngine.SetTestFilePath(String testFilePath) in c:\RelEng\Projects\MbUnit v2\Work\src\mbunit\MbUnit.Framework\Core\Remoting\RemoteTestEngine.cs:line 150

    Inner Exception

    System.Runtime.InteropServices.COMException

    Message: Cannot specify assembly evidence under MultiDomain after non-GAC assemblies with default evidence have been loaded in appdomain. (Exception from HRESULT: 0x8013101D)

    Source:

    StackTrace:







       --- End of inner exception stack trace ---

       at MbUnit.Core.Remoting.TestDomainBase.InitializeEngine() in c:\RelEng\Projects\MbUnit v2\Work\src\mbunit\MbUnit.Framework\Core\Remoting\TestDomainBase.cs:line 211

       at MbUnit.Core.Remoting.TestDomainBase.Load() in c:\RelEng\Projects\MbUnit v2\Work\src\mbunit\MbUnit.Framework\Core\Remoting\TestDomainBase.cs:line 240

       --- End of inner exception stack trace ---

       at MbUnit.Core.Remoting.TestDomainBase.Load() in c:\RelEng\Projects\MbUnit v2\Work\src\mbunit\MbUnit.Framework\Core\Remoting\TestDomainBase.cs:line 254

       at MbUnit.Core.Remoting.TestDomainBase.Reload() in c:\RelEng\Projects\MbUnit v2\Work\src\mbunit\MbUnit.Framework\Core\Remoting\TestDomainBase.cs:line 272

       --- End of inner exception stack trace ---

       at MbUnit.Core.Remoting.TestDomainBase.Reload() in c:\RelEng\Projects\MbUnit v2\Work\src\mbunit\MbUnit.Framework\Core\Remoting\TestDomainBase.cs:line 285

       at MbUnit.Core.Remoting.TreeTestDomainCollection.Reload() in c:\RelEng\Projects\MbUnit v2\Work\src\mbunit\MbUnit.Framework\Core\Remoting\TreeTestDomainCollection.cs:line 228

       at MbUnit.Forms.ReflectorTreeView.PopulateTree()
    ---------------------------
    OK  
    ---------------------------

    Thursday, August 25, 2011 5:04 PM