Exemplo n.º 1
0
        public void DependencyCheckerCheckDependenciesTest()
        {
            log.Info("-----------------------------DependencyChecker CheckDependencies-----------------------------");

            // Test setup
            string MyPlugin1 = Path.Combine(Directory.GetCurrentDirectory(), "TapPackages/MyPlugin1.TapPackage");
            string MyPlugin2 = Path.Combine(Directory.GetCurrentDirectory(), "TapPackages/MyPlugin2.1.2.37-alpha.715+164e6f81.TapPackage");
            string MyPlugin3 = Path.Combine(Directory.GetCurrentDirectory(), "TapPackages/MyPlugin3.TapPackage");

            // No dependencies
            EventTraceListener listener = new EventTraceListener();
            string             errors   = "";

            listener.MessageLogged += events => errors += Environment.NewLine + String.Join(Environment.NewLine, events.Select(m => m.Message));
            Log.AddListener(listener);
            Installation installation = new Installation(Directory.GetCurrentDirectory());
            var          issues       = DependencyChecker.CheckDependencies(installation, new string[] { MyPlugin1, MyPlugin2 });

            Log.RemoveListener(listener);
            Assert.IsTrue(issues == DependencyChecker.Issue.None, errors);
            log.Info("No dependencies - SUCCESS");

            // Dependency on plugin
            issues = DependencyChecker.CheckDependencies(installation, new string[] { MyPlugin1, MyPlugin2, MyPlugin3 });
            Assert.IsTrue(issues == DependencyChecker.Issue.BrokenPackages, "Dependency on plugin");
            log.Info("Dependency on plugin - SUCCESS");
        }
Exemplo n.º 2
0
		private void InitializeForm() {
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();

			// Dock panes
			if (!LoadDockSetings()) {
				CreateDockWindows();
			}

			ObjectEditorManager.HandlingStrategy = new MdiDocumentHandlingStrategy(this);

			// Context menu
			treeviewContextMenu.Popup += new EventHandler(TreeviewContextMenu_Popup);
			tvwProject.ContextMenu = treeviewContextMenu;

			// Trace listener
			_listener = new EventTraceListener();
			_listener.TextWritten += new TraceEvent(listener_TextWritten);
			Trace.Listeners.Add(_listener);

			// Menu bar
			SetupCommandBars();

			// Tree view
			RefreshUI();
		}
Exemplo n.º 3
0
        static bool Run(
            MethodInfo method,
            object instance,
            bool takesTestContext,
            Type expectedException,
            bool expectedExceptionAllowDerived)
        {
            Guard.NotNull(method, nameof(method));

            var parameters = takesTestContext ? new object[] { TestContextProxy.Proxy } : null;

            Exception exception            = null;
            bool      exceptionWasExpected = true;

            var traceListener = new EventTraceListener();

            Trace.Listeners.Add(traceListener);
            try
            {
                method.Invoke(instance, parameters);
            }
            catch (TargetInvocationException tie)
            {
                exception = tie.InnerException;
            }
            finally
            {
                Trace.Listeners.Remove(traceListener);
            }

            if (exception == null)
            {
                return(true);
            }

            var isExactExpectedException =
                expectedException != null &&
                exception.GetType() == expectedException;

            var isDerivedExpectedException =
                expectedException != null &&
                expectedExceptionAllowDerived &&
                exception.GetType().IsSubclassOf(expectedException);

            exceptionWasExpected = isExactExpectedException || isDerivedExpectedException;

            if (exceptionWasExpected)
            {
                EventHandlerPipeline.Raise(
                    new MethodExpectedExceptionEvent()
                {
                    ExpectedFullName = expectedException.FullName,
                    Exception        = new ExceptionInfo(exception),
                });
            }
            else
            {
                EventHandlerPipeline.Raise(
                    new MethodUnexpectedExceptionEvent()
                {
                    Exception = new ExceptionInfo(exception)
                });
            }

            return(exceptionWasExpected);
        }