Exemple #1
0
 //testing that the binID of a BinStatus object cannot be an empty string
 public void TestThatBinStatusBinIDEmptyStringIsInvalid()
 {
     testBin.binID = "";
     results       = TestValidationHelper.Validate(testBin);
     Assert.AreEqual(1, results.Count);
     Assert.AreEqual("BinID must be between 1 and 20 characters", results[0].ErrorMessage);
 }
        public void TestThatisEndResultIs500Characters()
        {
            testDbItem.endResult = new string('a', 500);
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }
Exemple #3
0
 //testing that the binID of a BinStatus object cannot be in an invalid format
 public void TestThatBinStatusBinIDInvalidFormatIsInvalid(string binID)
 {
     testBin.binID = binID;
     results       = TestValidationHelper.Validate(testBin);
     Assert.AreEqual(1, results.Count);
     Assert.AreEqual("BinID is not valid", results[0].ErrorMessage);
 }
Exemple #4
0
 //testing that the siteID of a BinStatus object cannot be in an invalid format
 public void TestThatBinStatusSiteIDLessThanOneIsInvalid()
 {
     testBin.siteID = 0;
     results        = TestValidationHelper.Validate(testBin);
     Assert.AreEqual(1, results.Count);
     Assert.AreEqual("The siteID must be a valid integer", results[0].ErrorMessage);
 }
Exemple #5
0
 //testing that the collectionDate of a BinStatus object must follow a valid format
 public void TestThatBinStatusDateBadFormatIsInvalid()
 {
     testBin.collectionDate = "20191-101-01";
     results = TestValidationHelper.Validate(testBin);
     Assert.AreEqual(1, results.Count);
     Assert.AreEqual("Collection date must be a valid date", results[0].ErrorMessage);
 }
        public void TestThatRecyclableReasonIs500Characters()
        {
            testDbItem.recycleReason = new string('a', 500);
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }
Exemple #7
0
 //testing that the status of a BinStatus object cannot be greater than 3
 public void TestThatBinStatusGreaterThan3IsInvalid()
 {
     testBin.status = 4;
     results        = TestValidationHelper.Validate(testBin);
     Assert.AreEqual(1, results.Count);
     Assert.AreEqual("A status can only be the value of 1, 2, or 3", results[0].ErrorMessage);
 }
        public void TestThatDescriptionis500Characters()
        {
            testDbItem.description = new string('a', 500);
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }
Exemple #9
0
 //testing that the collectionDate of a BinStatus object cannot be an empty string
 public void TestThatBinStatusDateEmptyStringIsInvalid()
 {
     testBin.collectionDate = "";
     results = TestValidationHelper.Validate(testBin);
     Assert.AreEqual(1, results.Count);
     Assert.AreEqual("Collection date is required", results[0].ErrorMessage);
 }
        public void TestThatIDIsValid()
        {
            testDbItem.ID = 1;
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
        }
        public void TestThatisEndResultisValid()
        {
            testDbItem.endResult = "toilet paper for babies. this ad was sponsered by huggies";
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //Noerror
        }
        public void TestThatNameIsEmpty()
        {
            testDbItem.name = null;
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("Name is required", results[0].ErrorMessage);
        }
        public void TestThatisRecyclableIsTrue()
        {
            testDbItem.isRecyclable = true;
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //NoError
        }
        public void TestThatPictureIDis90Characters()
        {
            testDbItem.imageURL = new string('a', 90);
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //error
        }
        public void TestThatPictureIDIsAString()
        {
            testDbItem.imageURL = "pizza";
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //no errors
        }
        public void TestThatInactiveIsFalse()
        {
            testDbItem.inactive = false;
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //NoError
        }
        public void TestThatRecyclableReasonIsValid()
        {
            testDbItem.recycleReason = "Because stone cold steve austin said so";
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //noerror
        }
        public void TestThatisqtyRecycledIsValid()
        {
            testDbItem.qtyRecycled = 1234567;
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //Noerror
        }
        public void TestThatDescriptionisValid()
        {
            testDbItem.description = "PRJ2Cosmo";
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);
            //NoError
        }
        public void TestThatDescriptionisGreaterThan500Characters()
        {
            testDbItem.description = new string('a', 501);
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("Description must be 500 characters or less.", results[0].ErrorMessage);
            //error
        }
        public void TestThatPictureIDCanNotbeGreaterThan90Characters()
        {
            testDbItem.imageURL = new string('a', 91);
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("PictureID must be 90 characters or less", results[0].ErrorMessage);
            //error
        }
        public void TestThatPictureIDIsEmpty()
        {
            testDbItem.imageURL = null;
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("PictureID is required", results[0].ErrorMessage);
            //errors
        }
        public void TestThatDescriptionisEmpty()
        {
            testDbItem.description = null;
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("Description is required", results[0].ErrorMessage);
            //error
        }
        public void TestThatNameIs50CharsLong()
        {
            testDbItem.name = new string('a', 50);
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(0, results.Count);

            //no errors
        }
        public void TestThatNameIs51CharsLong()
        {
            //ErrorMessage = "name must be 50 characters or less."
            testDbItem.name = new string('a', 51);
            var results = TestValidationHelper.Validate(testDbItem);

            Assert.AreEqual(1, results.Count);
            Assert.AreEqual("name must be 50 characters or less.", results[0].ErrorMessage);
        }
        public void TestThatRecyclableReasonIsEmpty()
        {
            testDbItem.recycleReason = null;
            var results = TestValidationHelper.Validate(testDbItem);

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

            //error
        }
        public void TestThatisEndResultIsEmpty()
        {
            testDbItem.endResult = null;
            var results = TestValidationHelper.Validate(testDbItem);

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


            //error
        }
Exemple #28
0
        //testing that invalid data returns parsed bin status object with invalid data
        public void TestThatParseDataMethodReturnsBinStatusObjectWithInalidData()
        {
            BinStatus binStatus = BinStatusParser.ParseBinStatusData(new string[] { "", "", "", "" });

            Assert.AreEqual("", binStatus.binID);
            Assert.AreEqual(0, binStatus.siteID);
            Assert.AreEqual(0, binStatus.status);
            Assert.AreEqual("", binStatus.collectionDate);

            //ensure bin received back is invalid
            results = TestValidationHelper.Validate(binStatus);
            Assert.AreEqual(4, results.Count);
        }
Exemple #29
0
        //testing that valid data returns parsed bin status object with same data
        public void TestThatParseDataMethodReturnsBinStatusObjectWithValidData()
        {
            var binStatus = BinStatusParser.ParseBinStatusData(new string[] { "1609312", "w114-320-203", "1-Jan-18", "Collected" });


            Assert.AreEqual("W114-320-203", binStatus.binID);
            Assert.AreEqual(1609312, binStatus.siteID);
            Assert.AreEqual(1, binStatus.status);
            Assert.AreEqual("2018-01-01", binStatus.collectionDate);

            //ensure bin received back is valid
            results = TestValidationHelper.Validate(binStatus);
            Assert.AreEqual(0, results.Count);
        }
Exemple #30
0
 //testing that the valid binID of a BinStatus object is valid
 public void TestThatBinStatusBinIDIsValid(string binId)
 {
     testBin.binID = binId;
     results       = TestValidationHelper.Validate(testBin);
     Assert.AreEqual(0, results.Count);
 }