public void AssemblyLoadCalledWhenAssemblyNameStartsWithColon()
        {
            DerivedRuntime runtime = new DerivedRuntime(":ICSharpCode.SharpDevelop", String.Empty);

            runtime.Load();
            Assert.AreEqual("ICSharpCode.SharpDevelop", runtime.AssemblyNamePassedToLoadAssembly);
        }
示例#2
0
        public void AssemblyLoadFromCalledWhenAssemblyNameStartsWithDollar()
        {
            IAddInTree     addInTree = CreateAddInTreeWithFormsDesignerAddIn();
            DerivedRuntime runtime   = new DerivedRuntime(addInTree, "$ICSharpCode.FormsDesigner/FormsDesigner.dll", String.Empty);

            runtime.Load();
            Assert.AreEqual(@"D:\SharpDevelop\AddIns\FormsDesigner\FormsDesigner.dll", runtime.AssemblyFileNamePassedToLoadAssemblyFrom);
        }
示例#3
0
        public void AssemblyLoadCalledWhenAssemblyNameStartsWithColon()
        {
            IAddInTree     addInTree = MockRepository.GenerateStrictMock <IAddInTree>();
            DerivedRuntime runtime   = new DerivedRuntime(addInTree, ":ICSharpCode.SharpDevelop", String.Empty);

            runtime.Load();
            Assert.AreEqual("ICSharpCode.SharpDevelop", runtime.AssemblyNamePassedToLoadAssembly);
        }
示例#4
0
        public void CoreExceptionErrorMessageShownAssemblyNameStartsWithDollarButHasNoForwardSlashCharacter()
        {
            IAddInTree     addInTree = MockRepository.GenerateStrictMock <IAddInTree>();
            DerivedRuntime runtime   = new DerivedRuntime(addInTree, "$ICSharpCode.FormsDesigner.dll", String.Empty);
            CoreException  ex        = Assert.Throws <CoreException>(delegate { runtime.Load(); });

            Assert.AreEqual("Expected '/' in path beginning with '$'!", ex.Message);
        }
        public void AssemblyLoadFromCalledWhenAssemblyNameStartsWithDollar()
        {
            List <AddIn>   addIns  = GetAddInsList();
            DerivedRuntime runtime = new DerivedRuntime("$ICSharpCode.FormsDesigner/FormsDesigner.dll", String.Empty, addIns);

            runtime.Load();
            Assert.AreEqual(@"D:\SharpDevelop\AddIns\FormsDesigner\FormsDesigner.dll", runtime.AssemblyFileNamePassedToLoadAssemblyFrom);
        }
        public void CoreExceptionErrorMessageShownAssemblyNameStartsWithDollarButHasNoForwardSlashCharacter()
        {
            List <AddIn>   addIns  = GetAddInsList();
            DerivedRuntime runtime = new DerivedRuntime("$ICSharpCode.FormsDesigner.dll", String.Empty, addIns);
            CoreException  ex      = Assert.Throws <CoreException>(delegate { runtime.Load(); });

            Assert.AreEqual("Expected '/' in path beginning with '$'!", ex.Message);
        }
        public void AssemblyLoadCalledWhenAssemblyNameDoesNotStartWithColonOrDollar()
        {
            string         hintPath = @"D:\SharpDevelop\AddIns\FormsDesigner";
            DerivedRuntime runtime  = new DerivedRuntime("FormsDesigner.dll", hintPath);

            runtime.Load();

            string expectedFileName = @"D:\SharpDevelop\AddIns\FormsDesigner\FormsDesigner.dll";

            Assert.AreEqual(expectedFileName, runtime.AssemblyFileNamePassedToLoadAssemblyFrom);
        }
        public void ErrorMessageShownWhenAddInReferenceCannotBeFound()
        {
            List <AddIn>   addIns  = new List <AddIn>();
            DerivedRuntime runtime = new DerivedRuntime("$UnknownAddIn/Unknown.dll", String.Empty, addIns);

            runtime.Load();

            string expectedErrorMessageStart =
                "The addin '$UnknownAddIn/Unknown.dll' could not be loaded:\n" +
                "System.IO.FileNotFoundException: Could not find referenced AddIn UnknownAddIn";
            string errorMessage = runtime.ErrorMessageDisplayed;

            Assert.IsTrue(errorMessage.StartsWith(expectedErrorMessageStart), errorMessage);
        }
示例#9
0
        public void ErrorMessageShownWhenLoadAssemblyFromThrowsFileLoadException()
        {
            IAddInTree        addInTree = MockRepository.GenerateStrictMock <IAddInTree>();
            DerivedRuntime    runtime   = new DerivedRuntime(addInTree, "Missing.dll", String.Empty);
            FileLoadException ex        = new FileLoadException("Test");

            runtime.LoadAssemblyFromExceptionToThrow = ex;
            runtime.Load();

            string expectedErrorMessageStart =
                "The addin 'Missing.dll' could not be loaded:\n" +
                "System.IO.FileLoadException: Test";
            string errorMessage = runtime.ErrorMessageDisplayed;

            Assert.IsTrue(errorMessage.StartsWith(expectedErrorMessageStart), errorMessage);
        }
示例#10
0
        public void ErrorMessageShownWhenAddInReferenceCannotBeFound()
        {
            IAddInTree addInTree = MockRepository.GenerateStrictMock <IAddInTree>();

            addInTree.Expect(a => a.AddIns).Return(new AddIn[0]);
            DerivedRuntime runtime = new DerivedRuntime(addInTree, "$UnknownAddIn/Unknown.dll", String.Empty);

            runtime.Load();

            string expectedErrorMessageStart =
                "The addin '$UnknownAddIn/Unknown.dll' could not be loaded:\n" +
                "System.IO.FileNotFoundException: Could not find referenced AddIn UnknownAddIn";
            string errorMessage = runtime.ErrorMessageDisplayed;

            Assert.IsTrue(errorMessage.StartsWith(expectedErrorMessageStart), errorMessage);
        }
        public void ErrorMessageShownWhenLoadAssemblyFromThrowsFileLoadException()
        {
            List <AddIn>      addIns  = new List <AddIn>();
            DerivedRuntime    runtime = new DerivedRuntime("Missing.dll", String.Empty, addIns);
            FileLoadException ex      = new FileLoadException("Test");

            runtime.LoadAssemblyFromExceptionToThrow = ex;
            runtime.Load();

            string expectedErrorMessageStart =
                "The addin 'Missing.dll' could not be loaded:\n" +
                "System.IO.FileLoadException: Test";
            string errorMessage = runtime.ErrorMessageDisplayed;

            Assert.IsTrue(errorMessage.StartsWith(expectedErrorMessageStart), errorMessage);
        }