public void CanParseBlankForm() { var environment = BuildDefaultOwinEnvironment(); var request = new Request(environment); Assert.IsNotNull(request.Form); Assert.IsEmpty(request.Form); }
public void CanParseQueryString() { string queryString = "?one=two&three=four&five=six&one=seven"; var environment = BuildDefaultOwinEnvironment(); environment[EnvironmentKeys.RequestQueryString] = queryString; var request = new Request(environment); Assert.AreEqual(3, request.Query.Count); CollectionAssert.AreEquivalent(new string[] { "two", "seven" }, request.Query["one"]); }
public void CanParsePostedForm() { string form = "one=two&three=four&five=six&one=seven"; var bytes = Encoding.UTF8.GetBytes(form); using (var stream = new MemoryStream(bytes)) { var environment = BuildDefaultOwinEnvironment(); environment[EnvironmentKeys.RequestBody] = stream; ((IDictionary<string, string[]>)environment[EnvironmentKeys.RequestHeaders]) ["Content-Type"] = new string[] { "application/x-www-form-urlencoded" }; var request = new Request(environment); Assert.IsNotNull(request.Form); CollectionAssert.AreEquivalent (new string[] { "one", "three", "five" }, request.Form.Keys); CollectionAssert.AreEquivalent (new string[] { "two", "seven" }, request.Form["one"]); } }
public void PathMustBeAppRelative() { var environment = BuildDefaultOwinEnvironment(); var request = new Request(environment); Assert.AreEqual(VirtualPathType.AppRelative, request.Path.Type); }