This object represents the default implementation of IUrlService.
Inheritance: IUrlService
        public void Constructor_BaseUrlReturnsCorrectValue()
        {
            System.Uri baseUri = new System.Uri("http://www.google.com");
            IUrlService service = new DefaultUrlService(baseUri, null);

            Assert.AreEqual(baseUri.ToString(), service.BaseUrl, @"
            The BaseUrl property should return the value of the uri that was passed to the constructor.
            ");
        }
        public void GetServiceUri_PathNoPreceedingSlash()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, "api");

            Assert.AreEqual(new System.Uri("https://www.cnn.gov/api/RelativeServicePath/PathAgain"), service.GetServiceUri("RelativeServicePath/PathAgain"), @"
            The GetServiceUri should take in a path and append the service prefix to the base url, then append
            the path to the result of that.
            ");
        }
        public void GetServiceUri_PathNull()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, "api");

            Assert.AreEqual(new System.Uri("https://www.cnn.gov/api"), service.GetServiceUri(null), @"
            The GetServiceUri should take in a path and append the service prefix to the base url, then append
            the path to the result of that.

            If we pass null in for the path, then it should be ignored.
            ");
        }
        public void GetServiceUri_PathWhiteSpaceAllOver()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, "api");

            Assert.AreEqual(new System.Uri("https://www.cnn.gov/api/RelativeServicePath/PathAgain"), service.GetServiceUri("  	RelativeServicePath/PathAgain  "), @"
            The GetServiceUri should take in a path and append the service prefix to the base url, then append
            the path to the result of that.

            All whitespace should be trimmed off of the path before it is used.
            ");
        }
        public void GetServiceUri_PathPreceedingSlash()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, "/api");

            Assert.AreEqual(new System.Uri("https://www.cnn.gov/api/RelativeServicePath/PathAgain"), service.GetServiceUri("/RelativeServicePath/PathAgain"), @"
            The GetServiceUri should take in a path and append the service prefix to the base url, then append
            the path to the result of that.

            Having a preceeding slash before the path should not prevent the service from creating
            a valid url.
            ");
        }
        public void GetUrl_WhiteSpaceAllOver()
        {
            System.Uri baseUri = new System.Uri("http://www.google.com");
            IUrlService service = new DefaultUrlService(baseUri, null);

            Assert.AreEqual("http://www.google.com/RelativePath/Path", service.GetUrl("   RelativePath/Path	"), @"
            The GetUrl method should take in a path and append it to the end of the base Url.
            All whitespace should be trimmed off of the path.
            ");
        }
        public void GetUrl_PreceedingSlash()
        {
            System.Uri baseUri = new System.Uri("http://www.google.com");
            IUrlService service = new DefaultUrlService(baseUri, null);

            Assert.AreEqual("http://www.google.com/RelativePath/Path", service.GetUrl("/RelativePath/Path"), @"
            The GetUrl method should take in a path and append it to the end of the base Url.
            If the path has a preceeding slash or not, it shouldn't matter.
            ");
        }
        public void GetUrl_NullPath()
        {
            System.Uri baseUri = new System.Uri("http://www.google.com");
            IUrlService service = new DefaultUrlService(baseUri, null);

            Assert.AreEqual(baseUri.ToString(), service.GetUrl(null), @"
            The GetUrl method should take in a path and append it to the end of the base Url.
            If null is passed for the path, then the base url should be returned.
            ");
        }
        public void GetServiceUrl_ServicePrefixNull()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, null);

            Assert.AreEqual("https://www.cnn.gov/RelativeServicePath/PathAgain", service.GetServiceUrl("RelativeServicePath/PathAgain"), @"
            The GetServiceUrl should take in a path and append the service prefix to the base url, then append
            the path to the result of that.

            If we pass null in for the service prefix, then it should be ignored.
            ");
        }
        public void GetServiceUrl_PathEmpty()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, "api");

            Assert.AreEqual("https://www.cnn.gov/api", service.GetServiceUrl(""), @"
            The GetServiceUrl should take in a path and append the service prefix to the base url, then append
            the path to the result of that.

            If the path is empty, then it should be ignored.
            ");
        }
        public void GetServiceUri_ServicePrefixEmpty()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, string.Empty);

            Assert.AreEqual(new System.Uri("https://www.cnn.gov/RelativeServicePath/PathAgain"), service.GetServiceUri("RelativeServicePath/PathAgain"), @"
            The GetServiceUri should take in a path and append the service prefix to the base url, then append
            the path to the result of that.

            If the service prefix is empty, then it should be ignored.
            ");
        }