private IOperation BuildShellOperation()
        {
            var aboutInfo       = new AboutNotificationInfo(text);
            var aboutController = new AboutNotificationController(configuration.AppConfig, uiFactory);
            var logInfo         = new LogNotificationInfo(text);
            var logController   = new LogNotificationController(logger, uiFactory);
            var activators      = new IActionCenterActivator[]
            {
                new KeyboardActivator(new ModuleLogger(logger, nameof(KeyboardActivator))),
                new TouchActivator(new ModuleLogger(logger, nameof(TouchActivator)))
            };
            var operation = new ShellOperation(
                actionCenter,
                activators,
                configuration.Settings.ActionCenter,
                logger,
                aboutInfo,
                aboutController,
                logInfo,
                logController,
                keyboardLayout,
                powerSupply,
                wirelessNetwork,
                systemInfo,
                taskbar,
                configuration.Settings.Taskbar,
                terminationActivator,
                text,
                uiFactory);

            return(operation);
        }
        private IOperation BuildShellOperation()
        {
            var aboutInfo       = new AboutNotificationInfo(text);
            var aboutController = new AboutNotificationController(context.AppConfig, uiFactory);
            var audio           = new Audio(context.Settings.Audio, ModuleLogger(nameof(Audio)));
            var keyboard        = new Keyboard(ModuleLogger(nameof(Keyboard)));
            var logInfo         = new LogNotificationInfo(text);
            var logController   = new LogNotificationController(logger, uiFactory);
            var powerSupply     = new PowerSupply(ModuleLogger(nameof(PowerSupply)));
            var wirelessAdapter = new WirelessAdapter(ModuleLogger(nameof(WirelessAdapter)));
            var operation       = new ShellOperation(
                actionCenter,
                audio,
                aboutInfo,
                aboutController,
                context,
                keyboard,
                logger,
                logInfo,
                logController,
                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);
        }
        public void MustSubscribeToClickEvent()
        {
            var button = new NotificationButtonMock();
            var sut    = new LogNotificationController(logger.Object, uiFactory.Object);

            sut.RegisterNotification(button);

            Assert.IsTrue(button.HasSubscribed);
        }
Exemple #4
0
        public void MustCloseWindowWhenTerminating()
        {
            var window = new Mock <IWindow>();
            var sut    = new LogNotificationController(logger.Object, uiFactory.Object);

            uiFactory.Setup(u => u.CreateLogWindow(It.IsAny <ILogger>())).Returns(window.Object);

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

            window.Verify(w => w.Close());
        }
Exemple #5
0
        public void MustOpenOnlyOneWindow()
        {
            var window = new Mock <IWindow>();
            var sut    = new LogNotificationController(logger.Object, uiFactory.Object);

            uiFactory.Setup(u => u.CreateLogWindow(It.IsAny <ILogger>())).Returns(window.Object);

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

            uiFactory.Verify(u => u.CreateLogWindow(It.IsAny <ILogger>()), Times.Once);
            window.Verify(u => u.Show(), Times.Once);
            window.Verify(u => u.BringToForeground(), Times.Exactly(4));
        }
Exemple #6
0
        private IOperation BuildShellOperation()
        {
            var aboutInfo       = new AboutNotificationInfo(text);
            var aboutController = new AboutNotificationController(configuration.AppConfig, uiFactory);
            var audio           = new Audio(configuration.Settings.Audio, new ModuleLogger(logger, nameof(Audio)));
            var keyboard        = new Keyboard(new ModuleLogger(logger, nameof(Keyboard)));
            var logInfo         = new LogNotificationInfo(text);
            var logController   = new LogNotificationController(logger, uiFactory);
            var powerSupply     = new PowerSupply(new ModuleLogger(logger, nameof(PowerSupply)));
            var wirelessAdapter = new WirelessAdapter(new ModuleLogger(logger, nameof(WirelessAdapter)));
            var activators      = new IActionCenterActivator[]
            {
                new KeyboardActivator(new ModuleLogger(logger, nameof(KeyboardActivator))),
                new TouchActivator(new ModuleLogger(logger, nameof(TouchActivator)))
            };
            var operation = new ShellOperation(
                actionCenter,
                activators,
                configuration.Settings.ActionCenter,
                audio,
                aboutInfo,
                aboutController,
                keyboard,
                logger,
                logInfo,
                logController,
                powerSupply,
                systemInfo,
                taskbar,
                configuration.Settings.Taskbar,
                terminationActivator,
                text,
                uiFactory,
                wirelessAdapter);

            return(operation);
        }
Exemple #7
0
        public void MustNotFailToTerminateIfNotStarted()
        {
            var sut = new LogNotificationController(logger.Object, uiFactory.Object);

            sut.Terminate();
        }