public void ListTestObjects_Samples_NotEqual()
        {
            var obj1 = new ListTestObject <string>()
            {
                Enumerable         = new[] { "test" },
                ReadOnlyCollection = new[] { "test2", "test22" },
                Collection         = new[] { "test3" },
                Array = new[] { "test4" },
                IList = new[] { "test5" },
                List  = new List <string> {
                    "test6"
                },
            };
            var obj2 = new ListTestObject <string>()
            {
                Enumerable         = new[] { "TEST" },
                ReadOnlyCollection = new[] { "TEST2", "TEST22" },
                Collection         = new[] { "TEST3" },
                Array = new[] { "TEST4" },
                IList = new[] { "TEST5" },
                List  = new List <string> {
                    "TEST6"
                },
            };

            AssertAreNotEqual(obj1, obj2);
        }
        public void ListTestObjects_EmptyObjectsWithSameType()
        {
            var obj1 = new ListTestObject <string>();
            var obj2 = new ListTestObject <string>();

            AssertAreEqual(obj1, obj2);
        }
        public void ListTestObjects_EmptyObjectsWithDifferentTypes()
        {
            var obj1 = new ListTestObject <string>();
            var obj2 = new ListTestObject <int>();

            AssertAreNotEqual(obj1, obj2);
        }
        public void ListTestObjects_EmptyObjectsWithDifferentCompatibleTypes()
        {
            var obj1 = new ListTestObject <Person>();
            var obj2 = new ListTestObject <Employee>();

            AssertAreNotEqual(obj1, obj2);
        }
Beispiel #5
0
        private void add_listbox_text()
        {
            string         texto      = this.textBox1.Text;
            ListTestObject tempObject = new ListTestObject();

            tempObject.name         = texto;
            tempObject.logical_name = texto + "5555";
            this.listBox.Items.Add(tempObject);
            this.textBox1.Text = "";
        }
Beispiel #6
0
        private void aniadir_lore_a_lista()
        {
            ListTestObject temp = new ListTestObject("AAA", "5555");

            this.listBox.Items.Add(temp);
            temp = new ListTestObject("BBB", "5555");
            this.listBox.Items.Add(temp);
            temp = new ListTestObject("CCC", "5555");
            this.listBox.Items.Add(temp);
        }
Beispiel #7
0
        private void click_on_list(object sender, MouseEventArgs e)
        {
            ListTestObject SELECTED_ITEM = this.listBox.SelectedItem as ListTestObject;

            if (SELECTED_ITEM != null)
            {
                Console.WriteLine(SELECTED_ITEM.logical_name + " " + SELECTED_ITEM.name);
            }
            else
            {
                Console.Write("No object");
            }
        }
		public void SetIndexedFromListProperty()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
			wrapper.SetPropertyValue("List[0]", 6);
			Assert.AreEqual(6, to.List[0]);
		}
		public void GetIndexOutofRangeFromListProperty()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
			wrapper.GetPropertyValue("List[5]");
		}
		public void SetIndexedFromListPropertyUsingMixOfSingleAndDoubleQuotedDelimeters()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
			wrapper.SetPropertyValue("List['0\"]", 6);
			Assert.AreEqual(6, to.List[0]);
		}
		public void GetIndexedPropertyValueWithMissingIndexFromListProperty()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
            Assert.Throws<InvalidPropertyException>(() => wrapper.GetPropertyValue("List[]"));
		}
		public void SetIndexOutOfRangeFromListProperty()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
			wrapper.SetPropertyValue("List[6]", 6);
			Assert.AreEqual(6, to.List[6]);
			Assert.IsNull(to.List[5]);
			wrapper.SetPropertyValue("List[7]", 7);
			Assert.AreEqual(7, to.List[7]);
		}
		public void SetIndexedFromListPropertyUsingEmptyValueForTheIndex()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
            Assert.Throws<InvalidPropertyException>(() => wrapper.SetPropertyValue("List[]", 6));
		}
		public void SetIndexedFromListPropertyUsingMixOfSingleAndDoubleQuotedDelimeters()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
            Assert.Throws<InvalidPropertyException>(() => wrapper.SetPropertyValue("List['0\"]", 6));
		}
		public void GetIndexedFromArrayListProperty()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.ArrayList = new ArrayList(new int[] {1, 2, 3, 4, 5});
			Assert.AreEqual(1, (int) wrapper.GetPropertyValue("ArrayList[0]"));
		}
		public void GetIndexedPropertyValueWithGuffIndexFromListProperty()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
			Assert.AreEqual(1, (int) wrapper.GetPropertyValue("List[HungerHurtsButStarvingWorks]"));
		}
		public void SetIndexedFromListPropertyUsingEmptyValueForTheIndex()
		{
			ListTestObject to = new ListTestObject();
			IObjectWrapper wrapper = GetWrapper(to);
			to.List = new ArrayList(new int[] {1, 2, 3, 4, 5});
			wrapper.SetPropertyValue("List[]", 6);
		}