public void the_content_is_written_to_the_stream() { var codec = new JsonDataContractCodec(); var stub = new InMemoryResponse(); codec.WriteTo(new Customer { Name = "hello" }, stub.Entity, null); stub.Entity.Stream.Position.ShouldNotBe(0); }
public void Given_ABasicAuthenticatorWithARealm_When_ChallengingAResponse_Then_TheResponseHasAWWWAuthenticateHeader() { // given string realm = "Lex Luthors Palace"; var response = new InMemoryResponse(); _mockAuthenticator .SetupGet(auth => auth.Realm) .Returns(realm); // when _basicScheme.Challenge(response); // then var expectedChallengeHeader = string.Format("Basic realm=\"{0}\"", realm); response.Headers.ShouldContain("WWW-Authenticate", expectedChallengeHeader); }
private void ReadResponse(InMemoryResponse response) { response.Entity.Stream.Position = 0; ResponseText = new StreamReader(response.Entity.Stream).ReadToEnd(); }
public void when_I_write(object obj) { response = new InMemoryResponse(); Codec.WriteTo(obj, response.Entity, new string[0]); ReadResponse(response); }
private void ReadResponse(InMemoryResponse response) { response.Entity.Stream.Position = 0; ResponseText = new StreamReader(response.Entity.Stream).ReadToEnd(); }
public void when_I_write(object obj) { response = new InMemoryResponse(); Codec.WriteTo(obj, response.Entity, new string[0]); ReadResponse(response); }