Skip to content

Commit

Permalink
Use expression-bodied methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr00d committed Sep 19, 2023
1 parent a4c1473 commit b62130b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions Vonage.Test.Unit/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,12 @@ private static string AssemblyDirectory
}

protected void Setup(string uri, string responseContent, string requestContent = null,
HttpStatusCode expectedCode = HttpStatusCode.OK)
{
HttpStatusCode expectedCode = HttpStatusCode.OK) =>
this.Setup(uri, new StringContent(responseContent, Encoding.UTF8, "application/json"), expectedCode,
requestContent);
}

protected void Setup(string uri, byte[] responseContent, HttpStatusCode expectedCode = HttpStatusCode.OK)
{
protected void Setup(string uri, byte[] responseContent, HttpStatusCode expectedCode = HttpStatusCode.OK) =>
this.Setup(uri, new StreamContent(new MemoryStream(responseContent)), expectedCode);
}

private void Setup(string uri, HttpContent httpContent, HttpStatusCode expectedCode,
string requestContent = null)
Expand Down Expand Up @@ -116,12 +112,8 @@ protected string GetResponseJson([CallerMemberName] string name = null)
return string.Empty;
}

protected string GetResponseJson(Dictionary<string, string> parameters, [CallerMemberName] string name = null)
{
var response = this.GetResponseJson(name);
response = TokenReplacementRegEx.Replace(response, match => parameters[match.Groups[1].Value]);
return response;
}
protected string GetResponseJson(Dictionary<string, string> parameters, [CallerMemberName] string name = null) =>
TokenReplacementRegEx.Replace(this.GetResponseJson(name), match => parameters[match.Groups[1].Value]);

protected string GetRequestJson([CallerMemberName] string name = null)
{
Expand Down

0 comments on commit b62130b

Please sign in to comment.