Example #1
0
        public void GetUrlLength2()
        {
            var urls     = RepositoryFactory.GetUrls();
            var actual   = urls.MySelect2(u => u.Length);
            var expected = new[]
            {
                19, 20, 19, 17
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToArray());
        }
Example #2
0
        public void ToHttps()
        {
            var urls = RepositoryFactory.GetUrls();
            IEnumerable <string> actual = WithoutLinq.ToHttps(urls);
            var expected = new List <string>
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com",
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #3
0
        public void Add91PortTest2()
        {
            var urls     = RepositoryFactory.GetUrls();
            var actual   = urls.MySelect2(s => s.Contains("tw") ? s + ":91" : s);
            var expected = new string[]
            {
                "http://tw.yahoo.com:91",
                "https://facebook.com",
                "https://twitter.com:91",
                "http://github.com"
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToArray());
        }
Example #4
0
        public void Add91PortTest()
        {
            var urls = RepositoryFactory.GetUrls();

            var actual   = YourOwnLinq.Append91Port(urls);
            var expected = new string[]
            {
                "http://tw.yahoo.com:91",
                "https://facebook.com",
                "https://twitter.com:91",
                "http://github.com"
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToArray());
        }
Example #5
0
        public void GetHttpsAdd80PortUrlTest()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.MySelect2(s => s.Contains("http:") ? s.Replace("http:", "https:") : s).MySelect2(s => s + ":80");

            var expected = new List <string>()
            {
                "https://tw.yahoo.com:80",
                "https://facebook.com:80",
                "https://twitter.com:80",
                "https://github.com:80",
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #6
0
        public void find_urls_should_return_url_length()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = WithoutLinq.GetUrlLength(urls);

            var expected = new List <int>()
            {
                19,
                20,
                19,
                17,
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #7
0
        public void url_length()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.EltonSelect(url => url.Length);

            var expected = new List <int>
            {
                19,
                20,
                19,
                17
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #8
0
        public void http_convert_to_https()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = WithoutLinq.CovertHttpToHttps(urls);

            var expected = new List <string>()
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com"
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #9
0
        public void GetUrlLength()
        {
            var urls = RepositoryFactory.GetUrls();
            IEnumerable <int> httpsUrls = WithoutLinq.GetUrlsLength(urls, url => url.Length);

            var expected = new List <int>()
            {
                19,
                20,
                19,
                17
            };

            expected.ToExpectedObject().ShouldEqual(httpsUrls.ToList());
        }
Example #10
0
        public void replace_http_to_https()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.Replace(url => url.Replace("http://", "https://"));

            var expected = new List <string>
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com"
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #11
0
        public void ReturnUrlLengh()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.JasonSelect(x => x.Length);

            var expected = new List <int>()
            {
                19,
                20,
                19,
                17
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #12
0
        public void replace_url_http_to_https_linq()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.Select(x => x.Replace("http:", "https:"));

            var expected = new List <string>()
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com",
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #13
0
        public void changeHttpToHttps()
        {
            var urls      = RepositoryFactory.GetUrls();
            var httpsUrls = WithoutLinq.ToHttps(urls);

            var expected = new List <string>()
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com"
            };

            expected.ToExpectedObject().ShouldEqual(httpsUrls.ToList());
        }
Example #14
0
        public void replace_url_http_to_https_by_length()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.MySelect(url => url.Length);

            var expected = new List <int>()
            {
                19,
                20,
                19,
                17,
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #15
0
        public void url_length()
        {
            var urls = RepositoryFactory.GetUrls();
            IEnumerable <int> actual = WithoutLinq.Map(urls, url => url.Length);

            var expected = new List <int>()
            {
                19,
                20,
                19,
                17
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #16
0
        public void find_urls_should_return_startwith_https()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = WithoutLinq.Tohttps(urls);

            var expected = new List <string>()
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com",
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #17
0
        public void GetHttpsUrlTest()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.MySelect2(s => s.Contains("http:") ? s.Replace("http:", "https:") : s);
            //var actual = WithoutLinq.Tohttps(urls);
            //urls.Select()
            var expected = new List <string>()
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com",
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #18
0
        public void Select_URL_Should_return_All_Https()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.JasonSelect(x => x.Replace("http:", "https:"));

            ;

            var expected = new List <string>()
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com",
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToList());
        }
Example #19
0
        public void ToHttpsUrl()
        {
            var urls   = RepositoryFactory.GetUrls();
            var actual = urls.MySelect(url =>
            {
                var s = url.Replace("http://", "https://");
                return(s);
            });
            var expected = new string[]
            {
                "https://tw.yahoo.com",
                "https://facebook.com",
                "https://twitter.com",
                "https://github.com"
            };

            expected.ToExpectedObject().ShouldEqual(actual.ToArray());
        }