예제 #1
0
        public void NotNull_Update()
        {
            TValidateData d = new TValidateData();
            d.Body = "body";
            Result result = db.insert( d );

            Assert.IsTrue( result.IsValid );

            d.Body = "";
            Result updateResult = db.update( d );
            Assert.IsFalse( updateResult.IsValid );
            Console.WriteLine( updateResult.ErrorsText );

            //自定义错误信息
            TValidateData2 d2 = new TValidateData2();
            d2.Body = "body";
            Result result2 = db.insert( d2 );
            Assert.IsTrue( result2.IsValid );
            d2.Body = "";
            Result updateResult2 = db.update( d2 );

            Assert.IsFalse( updateResult2.IsValid );
            Assert.AreEqual( "请填写内容", updateResult2.ErrorsText.Trim() );
            Console.WriteLine( updateResult2.ErrorsText );
        }
예제 #2
0
        public void NotNull_Update()
        {
            TValidateData d = new TValidateData();

            d.Body = "body";
            Result result = db.insert(d);

            Assert.IsTrue(result.IsValid);

            d.Body = "";
            Result updateResult = db.update(d);

            Assert.IsFalse(updateResult.IsValid);
            Console.WriteLine(updateResult.ErrorsText);


            //自定义错误信息
            TValidateData2 d2 = new TValidateData2();

            d2.Body = "body";
            Result result2 = db.insert(d2);

            Assert.IsTrue(result2.IsValid);
            d2.Body = "";
            Result updateResult2 = db.update(d2);


            Assert.IsFalse(updateResult2.IsValid);
            Assert.AreEqual("请填写内容", updateResult2.ErrorsText.Trim());
            Console.WriteLine(updateResult2.ErrorsText);
        }
예제 #3
0
        public void NotNull_Insert()
        {
            TValidateData d = new TValidateData();
            Result result = db.insert( d );

            Assert.IsFalse( result.IsValid );
            Console.WriteLine( result.ErrorsText );

            //自定义错误信息
            TValidateData2 d2 = new TValidateData2();
            Result result2 = db.insert( d2 );

            Assert.IsFalse( result2.IsValid );
            Assert.AreEqual( "请填写内容", result2.ErrorsText.Trim() );
            Console.WriteLine( result2.ErrorsText );
        }
예제 #4
0
        public void NotNull_Insert()
        {
            TValidateData d      = new TValidateData();
            Result        result = db.insert(d);

            Assert.IsFalse(result.IsValid);
            Console.WriteLine(result.ErrorsText);


            //自定义错误信息
            TValidateData2 d2      = new TValidateData2();
            Result         result2 = db.insert(d2);

            Assert.IsFalse(result2.IsValid);
            Assert.AreEqual("请填写内容", result2.ErrorsText.Trim());
            Console.WriteLine(result2.ErrorsText);
        }