public void LogoutValidUserTest() { using (TransactionScope transaction = new TransactionScope()) { UserRegisterRequestModel testUser = new UserRegisterRequestModel() { Username = "******", DisplayName = "validnick", AuthCode = new string('b', 40) }; UserRegisterResponseModel userModel = RegisterTestUserWithSKey(httpServer, testUser); var headers = new Dictionary<string, string>(); headers["X-sessionKey"] = userModel.SessionKey; UserLogoutRequestModel logoutModel = new UserLogoutRequestModel() { SessionKey = userModel.SessionKey }; var response = this.LogoutTestUser(httpServer, logoutModel, headers); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.IsNotNull(response.Content); } }
private HttpResponseMessage LogoutTestUser(InMemoryHttpServer httpServer, UserLogoutRequestModel userLogoutModel, Dictionary<string, string> headers) { var response = httpServer.Put("api/users/logout", userLogoutModel, headers); var contentString = response.Content.ReadAsStringAsync().Result; var userModel = JsonConvert.DeserializeObject<UserRegisterResponseModel>(contentString); return response; }