public void TestWritingResponse() { TokenResponse response = new TokenResponse { Body = "body", HttpStatusCode = 200 }; Mock<HttpResponseBase> mckResponse = new Mock<HttpResponseBase>(); mckResponse.SetupSet(x => x.ContentType = "application/json"); mckResponse.SetupSet(x => x.StatusCode = 200); mckResponse.Setup(x => x.Write("body")); TokenResponseWriter writer = new TokenResponseWriter(mckResponse.Object); writer.WriteResponse(response); mckResponse.VerifyAll(); }
public void TestWritingResponse() { TokenResponse response = new TokenResponse { Body = "body", HttpStatusCode = 200 }; Mock <HttpResponseBase> mckResponse = new Mock <HttpResponseBase>(); mckResponse.SetupSet(x => x.ContentType = "application/json"); mckResponse.SetupSet(x => x.StatusCode = 200); mckResponse.Setup(x => x.Write("body")); TokenResponseWriter writer = new TokenResponseWriter(mckResponse.Object); writer.WriteResponse(response); mckResponse.VerifyAll(); }
public static void WriteTokenResponse(this HttpResponseBase response, TokenResponse tokenResponse) { TokenResponseWriter writer = new TokenResponseWriter(response); writer.WriteResponse(tokenResponse); }