Collects error messages from validation
Inheritance: IValidationDictionary, IDataErrorInfo
コード例 #1
0
        public void ValidateForModelWithoutAttributes()
        {
            var value = 2;
            var state = new DefaultValidationWrapper();
            Assert.True(state.IsValid);

            value.ValidateFor<MyTest>(d => d.Id, state);
            Assert.True(state.IsValid);
            Assert.NotEqual("Req", state["Body"]);
        }
コード例 #2
0
        public void ValidateForModel()
        {
            var value = "";
            var state = new DefaultValidationWrapper();
            Assert.True(state.IsValid);

            value.ValidateFor<MyTest>(d=>d.Body,state);
            Assert.False(state.IsValid);
            Assert.Equal("Req", state["Body"]);
        }