public void Constructor()
        {
            var a = new DataKeyPropertyAttribute(null);

            Assert.AreEqual(null, a.Name, "#A1");

            a = new DataKeyPropertyAttribute("test");
            Assert.AreEqual("test", a.Name, "#A2");
        }
        public string GetPropertyNameExpression(string columnName)
        {
            // Get the DataKeyPropertyAttribute and use that as the to get the correct property name expression
            DataKeyPropertyAttribute attribute = _control.GetType().GetCustomAttributes(true).OfType <DataKeyPropertyAttribute>().FirstOrDefault();

            if ((attribute != null) && !String.IsNullOrEmpty(attribute.Name))
            {
                return(attribute.Name + String.Format(CultureInfo.InvariantCulture, "['{0}']", columnName));
            }
            //
            return(String.Empty);
        }
        public void EqualsTest()
        {
            var a = new DataKeyPropertyAttribute(null);

            Assert.IsFalse(a.Equals(null), "#A1-1");
            Assert.IsFalse(a.Equals("test"), "#A1-2");

            a = new DataKeyPropertyAttribute("test");
            Assert.IsFalse(a.Equals("test"), "#A2-1");
            Assert.IsTrue(a.Equals((object)new DataKeyPropertyAttribute("test")), "#A2-2");
            Assert.IsFalse(a.Equals(new DataKeyPropertyAttribute("invalid")), "#A2-3");
            Assert.IsFalse(a.Equals((object)new DataKeyPropertyAttribute("TEST")), "#A2-3");
        }