Пример #1
0
        public void Rule_Constructor_GetValueIsNotNull_PropertiesInitialized()

        {
            //------------Setup for test--------------------------

            //------------Execute Test---------------------------
            var rule = new TestRuleBase(() => "");

            //------------Assert Results-------------------------
            Assert.AreEqual("", rule.LabelText);
            Assert.AreEqual("Value is invalid.", rule.ErrorText);
            Assert.IsNull(rule.DoError);
        }
Пример #2
0
        public void Rule_CreatError_ReturnsNonNullError()

        {
            //------------Setup for test--------------------------
            var    doErrorWasAssigned = false;
            Action doError            = () => { doErrorWasAssigned = true; };

            var rule = new TestRuleBase(() => "")
            {
                DoError = doError
            };

            //------------Execute Test---------------------------
            var error = rule.TestCreatError();

            //------------Assert Results-------------------------
            Assert.IsNotNull(error);
            Assert.AreEqual("Value is invalid.", error.Message);
            error.Do();
            Assert.IsTrue(doErrorWasAssigned);
        }