Example #1
0
        public void DisplayFormat()
        {
            var row = new MyCar
            {
                Code   = "ABZ-01",
                Milage = 150000
            };

            Assert.AreEqual("150000", row["Milage"].ToString());
            Assert.AreEqual("Milage: 150,000 miles", row.GetDisplayFieldValue("Milage"));
        }
Example #2
0
        public void FieldValueDescription()
        {
            var row = new MyCar();

            row.Sex = "F";
            Assert.AreEqual("Female", row.GetFieldValueDescription("Sex"));

            row.Sex = "M";
            Assert.AreEqual("Male", row.GetFieldValueDescription("Sex"));

            row.Sex = "U";
            Assert.AreEqual("Unknown", row.GetFieldValueDescription("Sex"));
        }
Example #3
0
        public void ValidateRegexp()
        {
            var row = new MyCar
            {
                Code = "adsd"
            };

            var ve = row.Validate();

            Assert.IsNotNull(ve);
            Assert.IsTrue(ve.Message.Contains("Allowed characters: A-Z,0-9,-"));
            Console.WriteLine(ve.ToMessageWithType());

            row.Code = "AZ-90";
            ve       = row.Validate();
            Assert.IsNull(ve);
        }
        public void ValidateRegexp()
        {
            var row = new MyCar
            {
               Code = "adsd"
            };

            var ve = row.Validate();
            Assert.IsNotNull(ve);
            Assert.IsTrue( ve.Message.Contains("Allowed characters: A-Z,0-9,-"));
            Console.WriteLine( ve.ToMessageWithType());

            row.Code = "AZ-90";
            ve = row.Validate();
            Assert.IsNull(ve);
        }
        public void DisplayFormat()
        {
            var row = new MyCar
            {
               Code = "ABZ-01",
               Milage = 150000
            };

            Assert.AreEqual("150000", row["Milage"].ToString());
            Assert.AreEqual("Milage: 150,000 miles", row.GetDisplayFieldValue(null, "Milage"));
        }
        public void FieldValueDescription()
        {
            var row = new MyCar();

            row.Sex = "F";
            Assert.AreEqual("Female", row.GetFieldValueDescription("Sex"));

            row.Sex = "M";
            Assert.AreEqual("Male", row.GetFieldValueDescription("Sex"));

            row.Sex = "U";
            Assert.AreEqual("Unknown", row.GetFieldValueDescription("Sex"));
        }