public void PathInfoDictParse_CanHandleMissingSlash()
		{
			UrlParts builder = new UrlParts("controller", "action");
			builder.PathInfoDict.Parse("State/Fl");

			Assert.AreEqual("controller/action/State/Fl", builder.BuildPath());
		}
		public void BuildPathWithPathInfo()
		{
			UrlParts builder = new UrlParts("controller", "action");
			builder.PathInfo.Add("State").Add("FL");

			Assert.AreEqual("controller/action/State/FL", builder.BuildPath());
		}
		public void PathInfoDictParse_AcceptsEmptyString()
		{
			UrlParts builder = new UrlParts("controller", "action");
			builder.PathInfoDict.Parse("");

			Assert.AreEqual("controller/action", builder.BuildPath());
		}
		public void BuildPathWithPathInfoDictionary()
		{
			UrlParts builder = new UrlParts("controller", "action");
			builder.PathInfoDict["State"] ="FL";

			Assert.AreEqual("controller/action/State/FL", builder.BuildPath());
		}
		public void PathInfoDictParse_AcceptsNull()
		{
			var builder = new UrlParts(serverUtil, "controller", "action");
			builder.PathInfoDict.Parse(null);

			Assert.AreEqual("controller/action", builder.BuildPath());
		}
		public void BuildPathWithPathInfoAndQueryString()
		{
			UrlParts builder = new UrlParts("controller", "action");
			builder.PathInfoDict["State"] = "FL";
			builder.SetQueryString("type=Residential");

			Assert.AreEqual("controller/action/State/FL?type=Residential", builder.BuildPath());
		}
		public void PathInfoDictParse_CanHandleOddNumberOfEntries()
		{
			UrlParts builder = new UrlParts("controller", "action");
			builder.PathInfoDict.Parse("/State/FL/Type/");

			Assert.AreEqual("controller/action/State/FL/Type", builder.BuildPath());
		}
		public void InsertFrontPath_ShouldHandleTwoPathsWithSlash()
		{
			UrlParts builder = new UrlParts();
			builder.AppendPath("/something");

			builder.InsertFrontPath("http://something/else/");

			Assert.AreEqual("http://something/else/something", builder.BuildPath());
		}
		public void InsertFrontPath_ShouldKeepExistingPath()
		{
			UrlParts builder = new UrlParts("controller", "action");
			builder.PathInfo.Add("State").Add("FL");

			builder.InsertFrontPath("http://something");

			Assert.AreEqual("http://something/controller/action/State/FL", builder.BuildPath());
		}
示例#10
0
		public void QueryStringCanReplaceEntries()
		{
			UrlParts builder = new UrlParts("home/index.ext");

			builder.QueryString["page"] = "1";

			Assert.AreEqual("home/index.ext?page=1", builder.BuildPath());

			builder.QueryString.Set("page", "2");

			Assert.AreEqual("home/index.ext?page=2", builder.BuildPath());

			builder.QueryString.Set("page", "3");

			Assert.AreEqual("home/index.ext?page=3", builder.BuildPath());
		}
示例#11
0
		public void QueryStringCanHandleDuplicatedEntries()
		{
			UrlParts builder = new UrlParts("home/index.ext");

			builder.SetQueryString("City=SP&State=MD&State=NY");

			Assert.AreEqual("home/index.ext?City=SP&State=MD&State=NY", builder.BuildPath());
		}
示例#12
0
		public void QueryStringIsExtractedAndParsed()
		{
			UrlParts builder = new UrlParts("home/index.ext");

			builder.SetQueryString("City=SP&State=MD");

			builder.QueryString["type"] = "home";

			Assert.AreEqual("home/index.ext?City=SP&State=MD&type=home", builder.BuildPath());
		}
示例#13
0
		public void CanBuildPathUrls()
		{
			UrlParts builder = new UrlParts("controller", "action");
		
			Assert.AreEqual("controller/action", builder.BuildPath());
		}
示例#14
0
		public void QueryStringParsesStringCorrectly()
		{
			UrlParts builder = new UrlParts("home/index.ext");

			builder.QueryString["state"] = "FL";

			Assert.AreEqual("home/index.ext?state=FL", builder.BuildPath());
		}
		public void PathInfoDictParse_CanHandleMultipleEntries()
		{
			var builder = new UrlParts(serverUtil, "controller", "action");
			builder.PathInfoDict.Parse("/State/FL/Type/Home");

			Assert.AreEqual("controller/action/State/FL/Type/Home", builder.BuildPath());
		}