Esempio n. 1
0
        public void GetErrorOfPropertyReturnsError()
        {
            var mock   = new Mock();
            var result = Validator.GetError(mock, "Property");

            Assert.AreEqual("Property is required", result);
        }
Esempio n. 2
0
        public void GetErrorOfPropertyWithDisplayNameAttrReturnsError()
        {
            var mock   = new Mock();
            var result = Validator.GetError(mock, "PropertyWithDisplayName");

            Assert.AreEqual("Property With Display Name is required", result);
        }
Esempio n. 3
0
        public void GetErrorReturnsAllPropertyErrors()
        {
            var mock   = new Mock();
            var result = Validator.GetError(mock);

            Assert.IsTrue(result.Contains("Property is required"));
            Assert.IsTrue(result.Contains("Property With Display Name is required"));
        }
Esempio n. 4
0
        public void GetErrorReturnsError()
        {
            var mock = new Mock {
                Property = "Property",
                PropertyWithDisplayName = "PropertyWithDisplayName"
            };
            string result = Validator.GetError(mock);

            Assert.AreEqual("Property is NOT required of class attribute", result);
        }
Esempio n. 5
0
        public void GetErrorReturnsAllErrors()
        {
            var mock = new Mock {
                Property = "Property"
            };
            var result = Validator.GetError(mock);

            Assert.AreEqual(
                string.Join(Environment.NewLine,
                            "Property With Display Name is required",
                            "Property is NOT required of class attribute"),
                result);
        }