コード例 #1
0
ファイル: InterventionTest.cs プロジェクト: zukoj/SOEN490-ETD
        public void InterventionCompletedNotActiveTest()
        {
            Intervention a = new Intervention();

            a.Completed();
            Assert.AreNotEqual(a.IsActive(), a.IsCompleted());
        }
コード例 #2
0
ファイル: InterventionTest.cs プロジェクト: zukoj/SOEN490-ETD
        public void InterventionIsCompletedTrueTest()
        {
            Intervention a = new Intervention();

            a.Completed();
            Assert.IsTrue(a.IsCompleted());
        }
コード例 #3
0
ファイル: InterventionTest.cs プロジェクト: zukoj/SOEN490-ETD
        public void InterventionIsActivefalseTest()
        {
            Intervention a = new Intervention();

            a.Completed();
            Assert.IsFalse(a.IsActive());
        }
コード例 #4
0
        public void StatisticsSetNoOfInterventionsTest()
        {
            Statistics   statistics = new Statistics();
            Intervention i          = new Intervention();

            i.setTimeOfCall(DateTime.Now);
            statistics.setNumberOfInterventions();
            Assert.AreEqual(statistics.numberOfOngoingInterventions, 1);
            i.Completed();
            statistics.setNumberOfInterventions();
            Assert.AreEqual(statistics.numberOfCompletedInterventions, 1);
        }
コード例 #5
0
        //Submitting end of intervention
        private void EndIntervention(object sender, RoutedEventArgs e)
        {
            try
            {
                int      hh      = int.Parse(Endhh.Text);
                int      mm      = int.Parse(Endmm.Text);
                DateTime endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hh, mm, DateTime.Now.Second);
                int      offset  = (int)DateTime.Now.Subtract(endTime).TotalMinutes;

                List <Resource> resources = this.intervention.getResourceList();

                if (offset < 0)
                {
                    MessageBox.Show(ETD.Properties.Resources.MessageBox_Notification_FutureTime);
                }
                else
                {
                    ComboBoxItem conclusion = (ComboBoxItem)ConclusionBox.SelectedItem;

                    if (Grid.GetColumnSpan(ComboBoxBorder) == 1 && AdditionalInformation.Text.Equals(""))
                    {
                        MessageBox.Show(ETD.Properties.Resources.MessageBox_Notification_NoConclusion);
                    }
                    else
                    {
                        intervention.Completed();
                        intervention.setConclusionTime(endTime);
                        if (Grid.GetColumnSpan(ComboBoxBorder) == 1)
                        {
                            intervention.setConclusionAdditionalInfo(AdditionalInformation.Text);
                        }
                        interventionForm.CompleteIntervention(offset);
                    }
                }
                intervention.ResourceModified();
            }
            catch (FormatException ex)
            {
                MessageBox.Show(ETD.Properties.Resources.MessageBox_Notification_InvalidTime);
            }
        }