public void Entirely_empty()
		{
			var sut = new UrlSplitter("");
			Assert.AreEqual("", sut.Endpoint);
			Assert.AreEqual("", sut.Id);
			Assert.AreEqual("", sut.Option);
			Assert.AreEqual("", sut.Moar);
		}
		public void With_lots_of_things()
		{
			var sut = new UrlSplitter("projects/slug/build/blerg/snerf/collapsium");
			Assert.AreEqual("projects", sut.Endpoint);
			Assert.AreEqual("slug", sut.Id);
			Assert.AreEqual("build", sut.Option);
			Assert.AreEqual("blerg", sut.Moar);
		}
		public void With_slug_build_without_trailing_slash()
		{
			var sut = new UrlSplitter("projects/slug/build");
			Assert.AreEqual("projects", sut.Endpoint);
			Assert.AreEqual("slug", sut.Id);
			Assert.AreEqual("build", sut.Option);
			Assert.AreEqual("", sut.Moar);
		}
		public void Default_without_trailing_slash()
		{
			var sut = new UrlSplitter("projects");
			Assert.AreEqual("projects", sut.Endpoint);
			Assert.AreEqual("", sut.Id);
			Assert.AreEqual("", sut.Option);
			Assert.AreEqual("", sut.Moar);
		}
 public bool SendResponse(ApiRequest request)
 {
     _garbage.Collect();
     try
     {
         var url = new UrlSplitter(request.Url);
         HandleStuff(request, url);
     }
     catch (Exception ex)
     {
         request.Client.Send500_Failure(ex.ToString());
     }
     _garbage.Collect();
     return(true);
 }
 public bool SendResponse(ApiRequest request)
 {
     _garbage.Collect();
     try
     {
         var url = new UrlSplitter(request.Url);
         HandleStuff(request, url);
     }
     catch (Exception ex)
     {
         request.Client.Send500_Failure(ex.ToString());
     }
     _garbage.Collect();
     return true;
 }
        private void HandleStuff(ApiRequest request, UrlSplitter url)
        {
            if (url.Endpoint == "projects")
            {
                if (url.Id == "")
                {
                    HandleDefault(request);
                    return;
                }

                if (url.Option == "")
                {
                    HandleProject(url.Id, request);
                    return;
                }

                if (url.Option == "build" && url.Moar == "")
                {
                    HandleBuild(url.Id, request);
                    return;
                }
            }
            request.Client.Send404_NotFound();
        }
        private void HandleStuff(ApiRequest request, UrlSplitter url)
        {
            if (url.Endpoint == "projects")
            {
                if (url.Id == "")
                {
                    HandleDefault(request);
                    return;
                }

                if (url.Option == "")
                {
                    HandleProject(url.Id, request);
                    return;
                }

                if (url.Option == "build" && url.Moar == "")
                {
                    HandleBuild(url.Id, request);
                    return;
                }
            }
            request.Client.Send404_NotFound();
        }