public async Task PassingSeach() { var token = await GetToken(); var request = new HttpRequestMessage(HttpMethod.Get, "/api/user"); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); var response = await XClient.SendAsync(request, HttpCompletionOption.ResponseContentRead); var content = await response.Content.ReadAsStringAsync(); var payload = content.JsonToObj <ApiResultOk>(); Assert.Equal("Ok", payload.Message); }
public async Task FailingToken() { var dto = new LoginUserDto { Email = "*****@*****.**", Password = "******" }; var request = new HttpRequestMessage(HttpMethod.Post, "/oauth/connect-token") { Content = dto.ObjToHttpContent() }; var response = await XClient.SendAsync(request, HttpCompletionOption.ResponseContentRead); var content = await response.Content.ReadAsStringAsync(); var payload = content.JsonToObj <ApiResultOk>(); Assert.NotEqual("Ok", payload.Message); }
public async Task FailingRegister() { var dto = new RegisterUserDto { UserName = "******", Email = "*****@*****.**", Password = "******", Role = "User" }; var request = new HttpRequestMessage(HttpMethod.Post, "/api/account/register-user") { Content = dto.ObjToHttpContent() }; var response = await XClient.SendAsync(request, HttpCompletionOption.ResponseContentRead); var content = await response.Content.ReadAsStringAsync(); var payload = content.JsonToObj <ApiResultOk>(); Assert.NotEqual("Ok", payload.Message); }