public void LoadAssemblyFromReturnsICSharpCoreTestsAssemblyForUnknownAssemblyFileName()
        {
            DerivedRuntime runtime        = new DerivedRuntime("MyAddIn.dll", String.Empty);
            Assembly       loadedAssembly = runtime.CallLoadAssemblyFrom("tests.dll");

            string expectedLoadedAssemblyName = "ICSharpCode.Core.Tests.dll";

            Assert.AreEqual(expectedLoadedAssemblyName, loadedAssembly.ManifestModule.ToString());
        }
        public void LoadAssemblyFromReturnsKnownAssemblyFromAssemblyFileNamesCollection()
        {
            DerivedRuntime runtime = new DerivedRuntime("MyAddIn.dll", String.Empty);

            runtime.AssemblyFileNames.Add("MyAddIn.dll", typeof(string).Assembly);
            Assembly loadedAssembly = runtime.CallLoadAssemblyFrom(@"d:\projects\test\MyAddIn.dll");

            string expectedLoadedAssemblyName = "CommonLanguageRuntimeLibrary";

            Assert.AreEqual(expectedLoadedAssemblyName, loadedAssembly.ManifestModule.ToString());
        }
        public void LoadAssemblyFromThrowsPredefinedException()
        {
            DerivedRuntime       runtime           = new DerivedRuntime(":ICSharpCode.SharpDevelop", String.Empty);
            ApplicationException expectedException = new ApplicationException("Test");

            runtime.LoadAssemblyFromExceptionToThrow = expectedException;

            ApplicationException ex = Assert.Throws <ApplicationException>(delegate { runtime.CallLoadAssemblyFrom("test"); });

            Assert.AreEqual("Test", ex.Message);
        }