Skip to content
Browse files

Merge pull request #859 from jchannon/RequestFixtureFormatting

Removed unnecessary line and fixed formatting in RequestFixture
  • Loading branch information...
2 parents c00dbb9 + f49f0f6 commit 8ae0e19e2f582d4f9272f5581df493426f5b7ca6 @grumpydev grumpydev committed Dec 11, 2012
Showing with 42 additions and 40 deletions.
  1. +42 −40 src/Nancy.Tests/Unit/RequestFixture.cs
View
82 src/Nancy.Tests/Unit/RequestFixture.cs
@@ -16,12 +16,14 @@ public class RequestFixture
public void Should_dispose_request_stream_when_being_disposed()
{
// Given
- var stream = A.Fake<RequestStream>(x => {
- x.Implements(typeof (IDisposable));
+ var stream = A.Fake<RequestStream>(x =>
+ {
+ x.Implements(typeof(IDisposable));
x.WithArgumentsForConstructor(() => new RequestStream(0, false));
});
- var url = new Url() {
+ var url = new Url()
+ {
Scheme = "http",
Path = "localhost"
};
@@ -150,7 +152,7 @@ public void Should_set_uri_parameter_value_to_uri_property_when_initialized()
{
// Given
const string path = "/";
-
+
// When
var request = new Request("GET", path, "http");
@@ -198,7 +200,7 @@ public void Should_set_extract_form_data_from_body_when_content_type_is_x_www_fo
writer.Flush();
memory.Position = 0;
- var headers =
+ var headers =
new Dictionary<string, IEnumerable<string>>
{
{ "content-type", new[] { "application/x-www-form-urlencoded" } }
@@ -381,28 +383,28 @@ private static string GetStringValue(Stream stream)
return reader.ReadToEnd();
}
- [Fact]
- public void Should_be_able_to_invoke_form_repeatedly()
- {
- const string bodyContent = "name=John+Doe&gender=male&family=5&city=kent&city=miami&other=abc%0D%0Adef&nickname=J%26D";
- var memory = new MemoryStream();
- var writer = new StreamWriter(memory);
- writer.Write(bodyContent);
- writer.Flush();
- memory.Position = 0;
+ [Fact]
+ public void Should_be_able_to_invoke_form_repeatedly()
+ {
+ const string bodyContent = "name=John+Doe&gender=male&family=5&city=kent&city=miami&other=abc%0D%0Adef&nickname=J%26D";
+ var memory = new MemoryStream();
+ var writer = new StreamWriter(memory);
+ writer.Write(bodyContent);
+ writer.Flush();
+ memory.Position = 0;
- var headers =
- new Dictionary<string, IEnumerable<string>>
+ var headers =
+ new Dictionary<string, IEnumerable<string>>
{
{ "content-type", new[] { "application/x-www-form-urlencoded" } }
};
- // When
+ // When
var request = new Request("POST", "/", headers, CreateRequestStream(memory), "http");
- request.Form.ToString();
- // Then
- ((string)request.Form.name).ShouldEqual("John Doe");
- }
+
+ // Then
+ ((string)request.Form.name).ShouldEqual("John Doe");
+ }
[Fact]
public void Should_throw_argumentnullexception_when_initialized_with_null_protocol()
@@ -439,25 +441,25 @@ public void Should_set_protocol_parameter_value_to_protocol_property_when_initia
request.Url.Scheme.ShouldEqual(protocol);
}
- [Fact]
- public void Should_split_cookie_in_two_parts_only()
- {
- // Given, when
- var cookieName = "_nc";
- var cookieData = "Y+M3rcC/7ssXvHTx9pwCbwQVV4g=sp0hUZVApYgGbKZIU4bvXbBCVl9fhSEssEXSGdrt4jVag6PO1oed8lSd+EJD1nzWx4OTTCTZKjYRWeHE97QVND4jJIl+DuKRgJnSl3hWI5gdgGjcxqCSTvMOMGmW3NHLVyKpajGD8tq1DXhXMyXHjTzrCAYl8TGzwyJJGx/gd7VMJeRbAy9JdHOxEUlCKUnPneWN6q+/ITFryAa5hAdfcjXmh4Fgym75whKOMkWO+yM2icdsciX0ShcvnEQ/bXcTHTya6d7dJVfZl7qQ8AgIQv8ucQHxD3NxIvHNPBwms2ClaPds0HG5N+7pu7eMSFZjUHpDrrCnFvYN+JDiG3GMpf98LuCCvxemvipJo2MUkY4J1LvaDFoWA5tIxAfItZJkSIW2d8JPDwFk8OHJy8zhyn8AjD2JFqWaUZr4y9KZOtgI0V0Qlq0mS3mDSlLn29xapgoPHBvykwQjR6TwF2pBLpStsfZa/tXbEv2mc3VO3CnErIA1lEfKNqn9C/Dw6hqW";
- var headers = new Dictionary<string, IEnumerable<string>> ();
- var cookies = new List<string> ();
- cookies.Add (string.Format ("{0}={1}", cookieName, cookieData));
- headers.Add ("cookie", cookies);
- var newUrl = new Url
- {
- Path = "/"
- };
- var request = new Request ("GET", newUrl, null, headers);
-
- // Then
- request.Cookies[cookieName].ShouldEqual (cookieData);
- }
+ [Fact]
+ public void Should_split_cookie_in_two_parts_only()
+ {
+ // Given, when
+ var cookieName = "_nc";
+ var cookieData = "Y+M3rcC/7ssXvHTx9pwCbwQVV4g=sp0hUZVApYgGbKZIU4bvXbBCVl9fhSEssEXSGdrt4jVag6PO1oed8lSd+EJD1nzWx4OTTCTZKjYRWeHE97QVND4jJIl+DuKRgJnSl3hWI5gdgGjcxqCSTvMOMGmW3NHLVyKpajGD8tq1DXhXMyXHjTzrCAYl8TGzwyJJGx/gd7VMJeRbAy9JdHOxEUlCKUnPneWN6q+/ITFryAa5hAdfcjXmh4Fgym75whKOMkWO+yM2icdsciX0ShcvnEQ/bXcTHTya6d7dJVfZl7qQ8AgIQv8ucQHxD3NxIvHNPBwms2ClaPds0HG5N+7pu7eMSFZjUHpDrrCnFvYN+JDiG3GMpf98LuCCvxemvipJo2MUkY4J1LvaDFoWA5tIxAfItZJkSIW2d8JPDwFk8OHJy8zhyn8AjD2JFqWaUZr4y9KZOtgI0V0Qlq0mS3mDSlLn29xapgoPHBvykwQjR6TwF2pBLpStsfZa/tXbEv2mc3VO3CnErIA1lEfKNqn9C/Dw6hqW";
+ var headers = new Dictionary<string, IEnumerable<string>>();
+ var cookies = new List<string>();
+ cookies.Add(string.Format("{0}={1}", cookieName, cookieData));
+ headers.Add("cookie", cookies);
+ var newUrl = new Url
+ {
+ Path = "/"
+ };
+ var request = new Request("GET", newUrl, null, headers);
+
+ // Then
+ request.Cookies[cookieName].ShouldEqual(cookieData);
+ }
[Fact]
public void Should_move_request_body_position_to_zero_after_parsing_url_encoded_data()

0 comments on commit 8ae0e19

Please sign in to comment.
Something went wrong with that request. Please try again.