コード例 #1
0
        public void EDTEncodeEmptyOrNullUrlReturnsEmptyStringTest()
        {
            EncodeDecodeTinyUrl testObj = new EncodeDecodeTinyUrl();

            Assert.IsTrue(testObj.encode(string.Empty) == string.Empty);
            Assert.IsTrue(testObj.encode(null) == string.Empty);
        }
コード例 #2
0
        public void EDTDecodedInvalidTinyReturnsEmptyStringTest()
        {
            EncodeDecodeTinyUrl testObj = new EncodeDecodeTinyUrl();

            string superBigResponse = testObj.decode("somecrazykeythatdoesnotexist");

            Assert.IsTrue(superBigResponse == string.Empty);
        }
コード例 #3
0
        public void EDTDecodedTinyReturnsOriginalUrlTest()
        {
            EncodeDecodeTinyUrl testObj = new EncodeDecodeTinyUrl();

            string superBigUrl      = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
            string superBigResponse = testObj.decode(testObj.encode(superBigUrl));

            Assert.IsTrue(superBigResponse == superBigUrl);
        }
コード例 #4
0
        public void EDTUrlIsLongerThanTinyReturnsTinyUrlTest()
        {
            string bigUrl      = "cccccccccccccccccccccccccccc";
            string superBigUrl = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";

            EncodeDecodeTinyUrl testObj = new EncodeDecodeTinyUrl();

            string bigResponse      = testObj.encode(bigUrl);
            string superBigResponse = testObj.encode(superBigUrl);

            Assert.IsTrue(bigResponse != bigUrl);
            Assert.IsTrue(superBigResponse != superBigUrl);
        }
コード例 #5
0
        public void EDTUrlIsShorterOrEqualThanTinyReturnsOriginalUrlTest()
        {
            string littleUrl = "a";
            string mediumUrl = "bbbbbbbbbbbbbbbbbbbbbbbbbbb";

            EncodeDecodeTinyUrl testObj = new EncodeDecodeTinyUrl();

            string littleResponse = testObj.encode(littleUrl);
            string mediumResponse = testObj.encode(mediumUrl);

            Assert.IsTrue(littleResponse == littleUrl);
            Assert.IsTrue(mediumResponse == mediumUrl);
        }