Skip to content

Commit b82a6db

Browse files
authored
Merge pull request #17 from yizshi/run_dotnet_format
run dotnet format to lint whole project
2 parents 1bf5c40 + cc0fada commit b82a6db

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

duo_api_csharp/Duo.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public string ApiCall(string method,
214214
{
215215
string canon_params = DuoApi.CanonicalizeParams(parameters);
216216
string query = "";
217-
if (! method.Equals("POST") && ! method.Equals("PUT"))
217+
if (!method.Equals("POST") && !method.Equals("PUT"))
218218
{
219219
if (parameters.Count > 0)
220220
{
@@ -275,7 +275,8 @@ private HttpWebResponse AttemptRetriableHttpRequest(
275275
String method, String url, String auth, String date, String cannonParams, int timeout)
276276
{
277277
int backoffMs = INITIAL_BACKOFF_MS;
278-
while(true) {
278+
while (true)
279+
{
279280
// Do the request and process the result.
280281
HttpWebRequest request = PrepareHttpRequest(method, url, auth, date, cannonParams, timeout);
281282
HttpWebResponse response;
@@ -292,7 +293,8 @@ private HttpWebResponse AttemptRetriableHttpRequest(
292293
}
293294
}
294295

295-
if (response.StatusCode != (HttpStatusCode)RATE_LIMIT_HTTP_CODE || backoffMs > MAX_BACKOFF_MS) {
296+
if (response.StatusCode != (HttpStatusCode)RATE_LIMIT_HTTP_CODE || backoffMs > MAX_BACKOFF_MS)
297+
{
296298
return response;
297299
}
298300

@@ -453,15 +455,15 @@ public Dictionary<string, object> JSONPagingApiCall(string method,
453455
return this.BaseJSONApiCall(method, path, parameters, timeout, date);
454456
}
455457

456-
458+
457459
/// Helper to format a User-Agent string with some information about
458460
/// the operating system / .NET runtime
459461
/// <param name="product_name">e.g. "FooClient/1.0"</param>
460462
public static string FormatUserAgent(string product_name)
461463
{
462-
return String.Format(
463-
"{0} ({1}; .NET {2})", product_name, System.Environment.OSVersion,
464-
System.Environment.Version);
464+
return String.Format(
465+
"{0} ({1}; .NET {2})", product_name, System.Environment.OSVersion,
466+
System.Environment.Version);
465467
}
466468

467469
#region Private Methods

examples/Program.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ static int Main(string[] args)
2323
var r = client.JSONApiCall<Dictionary<string, object>>(
2424
"GET", "/admin/v1/info/authentication_attempts", parameters);
2525
var attempts = r["authentication_attempts"] as Dictionary<string, object>;
26-
foreach (KeyValuePair<string, object> info in attempts) {
26+
foreach (KeyValuePair<string, object> info in attempts)
27+
{
2728
var s = String.Format("{0} authentication(s) ended with {1}.",
2829
info.Value,
2930
info.Key);
@@ -34,18 +35,21 @@ static int Main(string[] args)
3435
var users = client.JSONApiCall<System.Collections.ArrayList>(
3536
"GET", "/admin/v1/users", parameters);
3637
System.Console.WriteLine(String.Format("{0} users.", users.Count));
37-
foreach (Dictionary<string, object> user in users) {
38+
foreach (Dictionary<string, object> user in users)
39+
{
3840
System.Console.WriteLine(
3941
"\t" + "Username: " + (user["username"] as string));
4042
}
4143

4244
// paging call
4345
int? offset = 0;
44-
while (offset != null) {
46+
while (offset != null)
47+
{
4548
var jsonResponse = client.JSONPagingApiCall("GET", "/admin/v1/users", parameters, (int)offset, 10);
4649
var pagedUsers = jsonResponse["response"] as System.Collections.ArrayList;
4750
System.Console.WriteLine(String.Format("{0} users at offset {1}", pagedUsers.Count, offset));
48-
foreach (Dictionary<string, object> user in pagedUsers) {
51+
foreach (Dictionary<string, object> user in pagedUsers)
52+
{
4953
System.Console.WriteLine(
5054
"\t" + "Username: " + (user["username"] as string));
5155
}

test/QueryParamsTest.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ public void Simple()
2323
}
2424

2525
[Fact]
26-
public void ZeroParams() {
26+
public void ZeroParams()
27+
{
2728
var parameters = new Dictionary<string, string>();
2829
Assert.Equal("", DuoApi.CanonicalizeParams(parameters));
2930
}
3031

3132
[Fact]
32-
public void OneParam() {
33+
public void OneParam()
34+
{
3335
var parameters = new Dictionary<string, string>
3436
{
3537
{"realname", "First Last"},
@@ -39,7 +41,8 @@ public void OneParam() {
3941
}
4042

4143
[Fact]
42-
public void PrintableASCII() {
44+
public void PrintableASCII()
45+
{
4346
var parameters = new Dictionary<string, string>
4447
{
4548
{"digits", "0123456789"},
@@ -52,7 +55,8 @@ public void PrintableASCII() {
5255
}
5356

5457
[Fact]
55-
public void UnicodeFuzzValues() {
58+
public void UnicodeFuzzValues()
59+
{
5660
var parameters = new Dictionary<string, string>
5761
{
5862
{"bar", "\u2815\uaaa3\u37cf\u4bb7\u36e9\ucc05\u668e\u8162\uc2bd\ua1f1"},
@@ -93,7 +97,7 @@ public void SortOrderWithCommonPrefix()
9397
[Fact]
9498
public void NextOffsetTest()
9599
{
96-
string[] offset = new string[]{"fjaewoifjew", "473891274832917498"};
100+
string[] offset = new string[] { "fjaewoifjew", "473891274832917498" };
97101
var parameters = new Dictionary<string, object>
98102
{
99103
{"next_offset", offset},

0 commit comments

Comments
 (0)