Example #1
0
        /// <summary>
        /// Makes a deep copy of the Medication.
        /// </summary>
        /// <remarks>
        /// All fields are deep copies.
        /// </remarks>
        /// <returns>A deep copy of the Medication.
        /// </returns>
        public object Clone()
        {
            Medication medication = new Medication();

            medication.CriticalAlertGraphic = this.CriticalAlertGraphic;
            medication.DosageText           = this.DosageText;
            medication.Dose             = this.Dose;
            medication.Form             = this.Form;
            medication.Frequency        = this.Frequency;
            medication.IndicatorGraphic = this.IndicatorGraphic;
            medication.IsSelected       = this.IsSelected;
            MedicationName[] medicationNames = new MedicationName[this.MedicationNames.Count];
            this.MedicationNames.CopyTo(medicationNames, 0);
            medication.MedicationNames.AddRange(medicationNames);
            medication.MedicationTooltip = this.MedicationTooltip;
            medication.Reason            = this.Reason;
            medication.StartDate         = this.StartDate;
            medication.Status            = this.Status;

            return(medication);
        }
Example #2
0
        public void MedicationNamesTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();
            MedicationName item = new MedicationName("Name", "Info");
            target.MedicationNames.Add(item);

            Assert.AreEqual(item, target.MedicationNames[0], "NhsCui.Toolkit.Web.MedicationNameLabel.MedicationNames was not set correctly.");            
        }
Example #3
0
 public void MedicationNamesTest()
 {
     MedicationLine target = new MedicationLine();
     MedicationName name = new MedicationName("NameTest", "InfoTest");
     target.MedicationNames.Add(name);
     Assert.AreEqual(name, target.MedicationNames[0], "NhsCui.Toolkit.Web.MedicationLine.MedicationNames was not set correctly.");
 }
 public void ValidateTest()
 {
     MedicationNameCollection target = new MedicationNameCollection();
     MedicationName name = new MedicationName("Name", "Information");
     int displayLength = name.DisplayLength;
     for (int i = 0; i < (MedicationName.MaximumDisplayLength / displayLength) + 1; i++)
     {
         target.Add(name);
     }
 }
        public void SetItemTest()
        {
            MedicationNameCollection target = new MedicationNameCollection();
            MedicationName item = new MedicationName("Name1", "Info1");
            target.Add(item);

            MedicationName item2 = new MedicationName("Name2", "Info2");
            target[0] = item2;
            Assert.AreEqual<MedicationName>(item2, target[0], "MedicationNameCollection setitem failed");
        }
 public void RemoveItemTest()
 {
     MedicationNameCollection target = new MedicationNameCollection();
     MedicationName item = new MedicationName("Name", "Info");
     target.Add(item);
     target.Remove(item);
     Assert.AreEqual<int>(0, target.Count, "MedicationName was not removed correctly");
 }
        public void OnPropertyChangedTest()
        {
            MedicationNameCollection target = new MedicationNameCollection();
            MedicationName item = new MedicationName();
            target.Add(item);

            target.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.OnPropertyChanged);
            this.propertyChangedThreadEvent.Reset();            
            
            string name = "NewInfo"; // TODO: Initialize to an appropriate value            
            item.Name = name;
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for Name Property");
            }
            else
            {
                Assert.AreEqual<string>(this.changedPropertyName, "Name");
            }            
        }
 public void InsertItemTest()
 {
     MedicationNameCollection target = new MedicationNameCollection();
     string name = "Name";
     string info = "Information";
     MedicationName item = new MedicationName(name, info);
     target.Add(item);
     Assert.AreEqual<int>(1, target.Count, "MedicationName was not added correctly");
     Assert.AreEqual<string>(name, target[0].Name, "MedicationName was not added correctly");
     Assert.AreEqual<string>(info, target[0].Information, "MedicationName was not added correctly");
 }