private IOperation BuildShellOperation()
        {
            var aboutNotification = new AboutNotification(context.AppConfig, text, uiFactory);
            var audio             = new Audio(context.Settings.Audio, ModuleLogger(nameof(Audio)));
            var keyboard          = new Keyboard(ModuleLogger(nameof(Keyboard)));
            var logNotification   = new LogNotification(logger, text, uiFactory);
            var operation         = new ShellOperation(
                actionCenter,
                audio,
                aboutNotification,
                context,
                keyboard,
                logger,
                logNotification,
                powerSupply,
                systemInfo,
                taskbar,
                taskview,
                text,
                uiFactory,
                wirelessAdapter);

            context.Activators.Add(new ActionCenterKeyboardActivator(ModuleLogger(nameof(ActionCenterKeyboardActivator)), nativeMethods));
            context.Activators.Add(new ActionCenterTouchActivator(ModuleLogger(nameof(ActionCenterTouchActivator)), nativeMethods));
            context.Activators.Add(new TaskviewKeyboardActivator(ModuleLogger(nameof(TaskviewKeyboardActivator)), nativeMethods));
            context.Activators.Add(new TerminationActivator(ModuleLogger(nameof(TerminationActivator)), nativeMethods));

            return(operation);
        }
Ejemplo n.º 2
0
        public void MustCloseWindowWhenTerminating()
        {
            var window = new Mock <IWindow>();
            var sut    = new AboutNotification(appConfig.Object, text.Object, uiFactory.Object);

            uiFactory.Setup(u => u.CreateAboutWindow(It.IsAny <AppConfig>())).Returns(window.Object);

            sut.Activate();
            sut.Terminate();

            window.Verify(w => w.Close());
        }
Ejemplo n.º 3
0
        public void MustOpenOnlyOneWindow()
        {
            var window = new Mock <IWindow>();
            var sut    = new AboutNotification(appConfig.Object, text.Object, uiFactory.Object);

            uiFactory.Setup(u => u.CreateAboutWindow(It.IsAny <AppConfig>())).Returns(window.Object);

            sut.Activate();
            sut.Activate();
            sut.Activate();
            sut.Activate();
            sut.Activate();

            uiFactory.Verify(u => u.CreateAboutWindow(It.IsAny <AppConfig>()), Times.Once);
            window.Verify(u => u.Show(), Times.Once);
            window.Verify(u => u.BringToForeground(), Times.Exactly(4));
        }
Ejemplo n.º 4
0
        public void MustNotFailToTerminateIfNotStarted()
        {
            var sut = new AboutNotification(appConfig.Object, text.Object, uiFactory.Object);

            sut.Terminate();
        }