Exemplo n.º 1
0
        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");
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        public void ClearTest()
        {
            MedicationNameCollection target = new MedicationNameCollection();

            target.Add(new MedicationName("Test"));
            target.Add(new MedicationName());
            target.Add(new MedicationName());
            target.Add(new MedicationName());
            target.Clear();
            Assert.AreEqual <int>(0, target.Count, "MedicationNameCollection did not clear the collection");
        }
Exemplo n.º 4
0
        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");
        }
Exemplo n.º 5
0
        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");
        }
Exemplo n.º 6
0
        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");
            }
        }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
        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");
        }
Exemplo n.º 9
0
 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");
 }
Exemplo n.º 10
0
        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");
            }            
        }
Exemplo n.º 11
0
 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");
 }
Exemplo n.º 12
0
 public void ClearTest()
 {
     MedicationNameCollection target = new MedicationNameCollection();
     target.Add(new MedicationName("Test"));
     target.Add(new MedicationName());
     target.Add(new MedicationName());
     target.Add(new MedicationName());
     target.Clear();
     Assert.AreEqual<int>(0, target.Count, "MedicationNameCollection did not clear the collection");
 }