Example #1
0
 public Renderer(IconController c)
 {
     this.controller       = c;
     this.contextMenuStrip = new ContextMenuStrip
     {
         RenderMode = ToolStripRenderMode.Professional
     };
 }
 public Renderer(IconController c)
 {
     this.controller = c;
     this.contextMenuStrip = new ContextMenuStrip
     {
         RenderMode = ToolStripRenderMode.Professional
     };
 }
        public void PomodoroTest()
        {
            using (var cs = new CherryService())
            {
                var ps = new PomodoroSensor();
                cs.PluginRepository.RegisterPlugin(ps);
                var tp = new FakeTimeProvider();
                cs.PluginRepository.RegisterPlugin(tp);
                cs.PluginRepository.RegisterPlugin(new FakeWindowsController());
                cs.PluginRepository.RegisterPlugin(new FakeSettingsController());
                var ic = new IconController();
                cs.PluginRepository.RegisterPlugin(ic);
                cs.PluginRepository.RegisterPlugin(new DatabaseController());

                var im = new FakeImController();
                cs.PluginRepository.RegisterPlugin(im);

                cs.InitializeCherryServiceEventsAndCommands();
                cs.PluginRepository.TieEvents();

                cs.PluginRepository.CherryCommands["Start Pomodoro"].Do(null);
                ic.UpdateToolTipTextMessage();

                Assert.True(ps.CurrentlyInPomodoro);
                Assert.That(ps.GetCurrentStatusData().Remaining.Minutes, Is.EqualTo(25));
                Assert.That(im.InPomodoro);
                Assert.That(ps.GetCurrentStatusData().MinutesLeft, Is.EqualTo(25));
                Assert.IsTrue(ic.ToolTipText.StartsWith("In pomodoro. 25 minutes left"));

                tp.AdvanceMinutes(3);
                ic.UpdateToolTipTextMessage();
                Assert.True(ps.CurrentlyInPomodoro);
                Assert.That(ps.GetCurrentStatusData().Remaining.Minutes, Is.EqualTo(22));
                Assert.That(ps.GetCurrentStatusData().MinutesLeft, Is.EqualTo(22));
                Assert.IsTrue(ic.ToolTipText.StartsWith("In pomodoro. 22 minutes left"));

                tp.AdvanceMinutes(22);
                ps.StopPomodoroInternal(true);
                Assert.That(ic.ToolTipText, Is.EqualTo("Pomodoro completed"));

                // Poll eniough times to make icon controller stop flashing.
                ic.StopFlashing();

                tp.AdvanceMinutes(10);
                ic.UpdateToolTipTextMessage();
                //Assert.That(cs.GetTimeSinceLastPomodoro().TotalMinutes, Is.EqualTo(10));
                Assert.That(im.InPomodoro, Is.False);
                Assert.IsTrue(ic.ToolTipText.StartsWith("Out of pomodoro for 10 minutes"));

                tp.AdvanceMinutes(59);
                ic.UpdateToolTipTextMessage();
                Assert.IsTrue(ic.ToolTipText.StartsWith("Out of pomodoro for 1 hour"));
            }
        }
        public void ManualFlashTest()
        {
            var cs = new CherryService();
            var tp = new TimeProvider();
            var ps = new PomodoroSensor();
            var ic = new IconController();
            var icn = new CherryTomato.Reminders.SystrayIconNotifier.IconNotifier();

            cs.PluginRepository.RegisterPlugin(tp);
            cs.PluginRepository.RegisterPlugin(ps);
            cs.PluginRepository.RegisterPlugin(ic);
            cs.PluginRepository.RegisterPlugin(icn);
            cs.InitializeCherryServiceEventsAndCommands();
            cs.PluginRepository.TieEvents();

            icn.Notify(new IconNotification { FlashCount = 10, FlashIconPath = "res://pomodoro.ico", NotificationText = "Flash test" });

            Assert.That(MessageBox.Show("Did the icon flash?", "Manual assert", MessageBoxButtons.YesNo),
                        Is.EqualTo(DialogResult.Yes));

            cs.Dispose();
        }
 public Flasher(IconController c)
 {
     this.controller = c;
 }
 public Flasher(IconController c)
 {
     this.controller = c;
 }