示例#1
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.");
        }
示例#2
0
        public void IndicatorGraphicTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();

            string val = "~/images/test.png";

            target.IndicatorGraphic = val;
            Assert.AreEqual(val, target.IndicatorGraphic, "NhsCui.Toolkit.Web.MedicationNameLabel.IndicatorGraphic was not set correctly.");
        }
示例#3
0
        public void ShowGraphicsTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();

            bool val = false; // TODO: Assign to an appropriate value for the property

            target.ShowGraphics = val;

            Assert.AreEqual(val, target.ShowGraphics, "NhsCui.Toolkit.Web.MedicationNameLabel.ShowGraphics was not set correctly.");
        }
示例#4
0
        public void DrugNameStyleTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();

            string val = "drugNameStyle";

            target.DrugNameStyle = val;

            Assert.AreEqual(val, target.DrugNameStyle, "NhsCui.Toolkit.Web.MedicationNameLabel.DrugNameStyle was not set correctly.");
        }
示例#5
0
        public void ShowGraphicsTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();

            bool val = false; // TODO: Assign to an appropriate value for the property

            target.ShowGraphics = val;

            Assert.AreEqual(val, target.ShowGraphics, "NhsCui.Toolkit.Web.MedicationNameLabel.ShowGraphics was not set correctly.");            
        }
示例#6
0
        public void OnPropertyChangedTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();            
            
            target.CriticalAlertGraphic = "";
            target.DrugNameStyle = "";
            target.ShowGraphics = false;
            target.MedicationNames.Add(new MedicationName("Name", "Info"));

            target.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.OnPropertyChanged);
            this.propertyChangedThreadEvent.Reset();

            target.CriticalAlertGraphic = "~/image/test.png";
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for CriticalAlertGraphic Property");
            }
            else
            {
                Assert.AreEqual<string>(this.changedPropertyName, "CriticalAlertGraphic");
            }

            target.DrugNameStyle = "~/image/test.png";
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for DrugNameStyle Property");
            }
            else
            {
                Assert.AreEqual<string>(this.changedPropertyName, "DrugNameStyle");
            }

            target.ShowGraphics = true;
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for ShowGraphics Property");
            }
            else
            {
                Assert.AreEqual<string>(this.changedPropertyName, "ShowGraphics");
            }

            target.MedicationNames[0].Name = "NewName";
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for MedicationName Name Property");
            }
            else
            {
                Assert.AreEqual<string>(this.changedPropertyName, "Name");
            }

            target.MedicationNames[0].Information = "NewInfo";
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for MedicationName Info Property");
            }
            else
            {
                Assert.AreEqual<string>(this.changedPropertyName, "Information");
            }

            this.propertyChangedThreadEvent.Close();
        }
示例#7
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.");            
        }
示例#8
0
        public void IndicatorGraphicTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();

            string val = "~/images/test.png"; 

            target.IndicatorGraphic = val;
            Assert.AreEqual(val, target.IndicatorGraphic, "NhsCui.Toolkit.Web.MedicationNameLabel.IndicatorGraphic was not set correctly.");
        }
示例#9
0
        public void DrugNameStyleTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();

            string val = "drugNameStyle"; 

            target.DrugNameStyle = val;

            Assert.AreEqual(val, target.DrugNameStyle, "NhsCui.Toolkit.Web.MedicationNameLabel.DrugNameStyle was not set correctly.");            
        }
示例#10
0
        /// <summary>
        /// Add a MedicationNameLabel to the view
        /// </summary>
        /// <param name="medication">Medication to extract MedicationName from</param>
        /// <param name="parent">Parent Panel</param>
        /// <param name="cssClass">CssClass to apply to the MedicationNameLable</param>
        private void AddMedicationNameLabel(Medication medication, Panel parent, string cssClass)
        {   
            MedicationNameLabel medicationNameLabel = new MedicationNameLabel(medication.MedicationNames);
            medicationNameLabel.EnableViewState = false;
            medicationNameLabel.EnableExtender = false;
            medicationNameLabel.ShowGraphics = this.showGraphics;
            medicationNameLabel.CriticalAlertGraphic = medication.CriticalAlertGraphic;
            medicationNameLabel.IndicatorGraphic = medication.IndicatorGraphic;
            medicationNameLabel.AllowWrap = false;
            medicationNameLabel.ToolTip = medication.MedicationTooltip;
            medicationNameLabel.CssClass = cssClass;

            // Add each DrugLabel control
            parent.Controls.Add(medicationNameLabel);            
        }
示例#11
0
        public void OnPropertyChangedTest()
        {
            MedicationNameLabel target = new MedicationNameLabel();

            target.CriticalAlertGraphic = "";
            target.DrugNameStyle        = "";
            target.ShowGraphics         = false;
            target.MedicationNames.Add(new MedicationName("Name", "Info"));

            target.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.OnPropertyChanged);
            this.propertyChangedThreadEvent.Reset();

            target.CriticalAlertGraphic = "~/image/test.png";
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for CriticalAlertGraphic Property");
            }
            else
            {
                Assert.AreEqual <string>(this.changedPropertyName, "CriticalAlertGraphic");
            }

            target.DrugNameStyle = "~/image/test.png";
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for DrugNameStyle Property");
            }
            else
            {
                Assert.AreEqual <string>(this.changedPropertyName, "DrugNameStyle");
            }

            target.ShowGraphics = true;
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for ShowGraphics Property");
            }
            else
            {
                Assert.AreEqual <string>(this.changedPropertyName, "ShowGraphics");
            }

            target.MedicationNames[0].Name = "NewName";
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for MedicationName Name Property");
            }
            else
            {
                Assert.AreEqual <string>(this.changedPropertyName, "Name");
            }

            target.MedicationNames[0].Information = "NewInfo";
            if (!this.propertyChangedThreadEvent.WaitOne(500, false))
            {
                Assert.Fail("Property Changed event was not raised for MedicationName Info Property");
            }
            else
            {
                Assert.AreEqual <string>(this.changedPropertyName, "Information");
            }

            this.propertyChangedThreadEvent.Close();
        }