示例#1
0
        public void OfflineDialogInterfaceDelegateCallbackTest()
        {
            OfflineDialogInterface target = new OfflineDialogInterface();

            bool calledBack = false;

            target.OnSubmit = (processData) => { calledBack = true; };

            OfflineDialogInterfaceSubmitFor(target);

            Assert.IsTrue(calledBack, "Submit should call back on submit");
        }
示例#2
0
        private void OfflineDialogInterfaceSubmitFor(OfflineDialogInterface target)
        {
            string   name    = "Help";
            string   comment = "Some guy";
            DateTime st      = DateTime.Now.AddMinutes(-6);
            DateTime ed      = DateTime.Now;

            target.Submit(name, comment, st, ed);

            Assert.AreEqual(target.ProcessData.StartTime, st, "Should be same objects");
            Assert.AreEqual(target.ProcessData.EndTime, ed, "Should be same objects");
            Assert.AreEqual(target.ProcessData.Name, name, "Should be same objects");
        }
示例#3
0
        public void OfflineDialogInterfaceConfigTest()
        {
            //<add key="button1" value="test1"/>
            //<add key="button2" value="test2"/>
            //<add key="button3" value="test3"/>
            //<add key="button4" value="test4"/>
            //<add key="button5" value="test5"/>
            //<add key="button6" value="test6"/>
            OfflineDialogInterface target = new OfflineDialogInterface();

            string[] expected = { "test1",
                                  "test2",
                                  "test3",
                                  "test4",
                                  "test5",
                                  "test6" };

            string[] actual = target.GetButtonText().ToArray();

            CollectionAssert.AreEqual(expected, actual, "should read from test app.config");
        }
示例#4
0
        public OfflineTimeForm(IClientInterface client, DateTime offlineSince)
        {
            InitializeComponent();

            _clientManager       = client;
            _offlineSince        = offlineSince;
            _isFirstNotification = true;

            _clientManager.Alert.AlertSystemIsBusy += new Action <DateTime>(Alert_AlertSystemIsBusy);

            _connector = new OfflineDialogInterface();

            _buttonsText = _clientManager.Settings.OfflineTaskCategory;

            //_connector.GetButtonText();

            Debug.Assert(_buttonsText.Length == 6, "GetButtonText returned count != 6");

            // any better way to do this
            this.button1.Text = _buttonsText[0];
            this.button2.Text = _buttonsText[1];
            this.button3.Text = _buttonsText[2];
            this.button4.Text = _buttonsText[3];
            this.button5.Text = _buttonsText[4];
            this.button6.Text = _buttonsText[5];

            lblWhatHaveSince.Text = string.Format("What have you been doing since {0}?", offlineSince.ToString("HH:MM"));

            _timer = new Timer()
            {
                Interval = 1000, Enabled = true
            };

            _timer.Tick += new EventHandler(_timer_Tick);

            _timer.Start();

            _DebugDisableAlwaysOnTop();
        }