|
1 | | -using exercise.wwwapi.DTOs; |
2 | | -using exercise.wwwapi.DTOs.Login; |
| 1 | +using exercise.wwwapi.DTOs.Login; |
3 | 2 | using exercise.wwwapi.DTOs.Register; |
4 | | -using exercise.wwwapi.Models; |
5 | | -using Microsoft.AspNetCore.Http; |
6 | 3 | using Microsoft.AspNetCore.Mvc.Testing; |
7 | 4 | using System.Net; |
8 | 5 | using System.Text; |
@@ -34,14 +31,15 @@ public void TearDown() |
34 | 31 | } |
35 | 32 |
|
36 | 33 | // ad test cases for approved usernames, emails |
37 | | - [Test, TestCaseSource(typeof(UserTestCases), nameof(UserTestCases.ValidRegisterCases))] |
| 34 | + [Test, TestCaseSource(typeof(UserTestCases), nameof(UserTestCases.ValidRegisterCases))] |
38 | 35 | public async Task Register_success(string username, string email, string password) |
39 | 36 | { |
40 | 37 | var uniqueId = DateTime.UtcNow.ToString("yyMMddHHmmssffff"); |
41 | 38 |
|
42 | 39 | string uniqueUsername = username.Length > 0 ? username + uniqueId : ""; |
43 | 40 |
|
44 | | - RegisterRequestDTO body = new RegisterRequestDTO { |
| 41 | + RegisterRequestDTO body = new RegisterRequestDTO |
| 42 | + { |
45 | 43 | email = $"{uniqueId}{email}", |
46 | 44 | password = password |
47 | 45 | }; |
@@ -77,7 +75,7 @@ public async Task Register_Failure(string username, string email, string passwor |
77 | 75 | email = $"{uniqueId}{email}", |
78 | 76 | password = password |
79 | 77 | }; |
80 | | - |
| 78 | + |
81 | 79 | var json = JsonSerializer.Serialize(body); |
82 | 80 | var requestBody = new StringContent(json, Encoding.UTF8, "application/json"); |
83 | 81 |
|
@@ -186,7 +184,7 @@ public async Task UpdateUserSuccess() |
186 | 184 | [Test] |
187 | 185 | public async Task UpdateUserNullFieldsOnly() |
188 | 186 | { |
189 | | - var fieldsToUpdate = new Dictionary<string, object?>{}; |
| 187 | + var fieldsToUpdate = new Dictionary<string, object?> { }; |
190 | 188 |
|
191 | 189 | var json = JsonSerializer.Serialize(fieldsToUpdate); |
192 | 190 | var content = new StringContent(json, Encoding.UTF8, "application/json"); |
|
0 commit comments