コード例 #1
0
        public void TestThatisEndResultIs500Characters()
        {
            testDbItem.endResult = new string('a', 500);
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }
コード例 #2
0
        public void TestThatDescriptionis500Characters()
        {
            testDbItem.description = new string('a', 500);
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }
コード例 #3
0
        public void TestThatIDIsValid()
        {
            testDbItem.ID = 1;
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }
コード例 #4
0
        public void TestThatRecyclableReasonIs500Characters()
        {
            testDbItem.recycleReason = new string('a', 500);
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }
コード例 #5
0
        public void TestThatPictureIDIsAString()
        {
            testDbItem.imageURL = "pizza";
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //no errors
        }
コード例 #6
0
        public void TestThatDescriptionisValid()
        {
            testDbItem.description = "PRJ2Cosmo";
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //NoError
        }
コード例 #7
0
        public void TestThatisqtyRecycledIsValid()
        {
            testDbItem.qtyRecycled = 1234567;
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //Noerror
        }
コード例 #8
0
        public void TestThatNameIsEmpty()
        {
            testDbItem.name = null;
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("Name is required", results[0].ErrorMessage);
        }
コード例 #9
0
        public void TestThatRecyclableReasonIsValid()
        {
            testDbItem.recycleReason = "Because stone cold steve austin said so";
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //noerror
        }
コード例 #10
0
        public void TestThatisEndResultisValid()
        {
            testDbItem.endResult = "toilet paper for babies. this ad was sponsered by huggies";
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //Noerror
        }
コード例 #11
0
        public void TestThatisRecyclableIsTrue()
        {
            testDbItem.isRecyclable = true;
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //NoError
        }
コード例 #12
0
        public void TestThatPictureIDis90Characters()
        {
            testDbItem.imageURL = new string('a', 90);
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //error
        }
コード例 #13
0
        public void TestThatNameIs50CharsLong()
        {
            testDbItem.name = new string('a', 50);
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);

            //no errors
        }
コード例 #14
0
        public void TestThatNameIs51CharsLong()
        {
            //ErrorMessage = "name must be 50 characters or less."
            testDbItem.name = new string('a', 51);
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("name must be 50 characters or less.", results[0].ErrorMessage);
        }
コード例 #15
0
        public void TestThatDescriptionisGreaterThan500Characters()
        {
            testDbItem.description = new string('a', 501);
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("Description must be 500 characters or less.", results[0].ErrorMessage);
            //error
        }
コード例 #16
0
        public void TestThatPictureIDIsEmpty()
        {
            testDbItem.imageURL = null;
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("PictureID is required", results[0].ErrorMessage);
            //errors
        }
コード例 #17
0
        public void TestThatDescriptionisEmpty()
        {
            testDbItem.description = null;
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("Description is required", results[0].ErrorMessage);
            //error
        }
コード例 #18
0
        public void TestThatPictureIDCanNotbeGreaterThan90Characters()
        {
            testDbItem.imageURL = new string('a', 91);
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("PictureID must be 90 characters or less", results[0].ErrorMessage);
            //error
        }
コード例 #19
0
        public void TestThatRecyclableReasonIsEmpty()
        {
            testDbItem.recycleReason = null;
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("Disposable must have a recyclable reason", results[0].ErrorMessage);

            //error
        }
コード例 #20
0
        public void TestThatisEndResultIsEmpty()
        {
            testDbItem.endResult = null;
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("An end result is required", results[0].ErrorMessage);


            //error
        }
コード例 #21
0
        public void AllRecyclableInformationIsValidTest()
        {
            var results = HelperTestModel.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }