Skip to content

Commit b31fe13

Browse files
authored
Merge pull request #99 from boolean-uk/reduan-azouaghe-dotnet-format-1
Chore: Format solution and remove unused directives
2 parents 61a7f5f + a1eef91 commit b31fe13

32 files changed

+82
-142
lines changed

exercise.tests/Helpers/UserTestCases.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using NUnit.Framework;
2-
using System.Collections.Generic;
3-
41
namespace exercise.tests.Helpers
52
{
63
public static class UserTestCases

exercise.tests/Helpers/UsernameValidationCases.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using NUnit.Framework;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Net;
1+
using System.Net;
52

63
namespace exercise.tests.Helpers
74
{
85
public static class UsernameValidationTestData
96
{
107
public static IEnumerable<TestCaseData> UsernameValidationMessageCases()
11-
{
8+
{
129
string[] endpoints = new string[]
1310
{
1411
"username",
@@ -103,6 +100,6 @@ public static IEnumerable<TestCaseData> UsernameValidationStatusCases()
103100
}
104101
}
105102
}
106-
103+
107104
}
108105
}

exercise.tests/IntegrationTests/EndpointStatusTest.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using exercise.wwwapi.DTOs.Login;
2-
using exercise.wwwapi.DTOs.Register;
3-
using Microsoft.AspNetCore.Http;
4-
using Microsoft.AspNetCore.Mvc.Testing;
1+
using Microsoft.AspNetCore.Mvc.Testing;
52
using System.Net;
63
using System.Text;
74
using System.Text.Json;
@@ -30,11 +27,12 @@ public void TearDown()
3027
_factory.Dispose();
3128
}
3229

33-
[Test]
30+
[Test]
3431
public async Task PostCheckInvalidEndpoint()
3532
{
36-
var body = new {
37-
email= $"[email protected]",
33+
var body = new
34+
{
35+
email = $"[email protected]",
3836
password = "someR21!password"
3937
};
4038
var json = JsonSerializer.Serialize(body);

exercise.tests/IntegrationTests/PostTests.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
using exercise.wwwapi.DTOs.Posts;
2-
using Microsoft.AspNetCore.Http;
32
using Microsoft.AspNetCore.Mvc.Testing;
4-
using System;
5-
using System.Collections.Generic;
6-
using System.Linq;
73
using System.Net;
84
using System.Text;
95
using System.Text.Json;
106
using System.Text.Json.Nodes;
11-
using System.Threading.Tasks;
127

138
namespace exercise.tests.IntegrationTests
149
{

exercise.tests/IntegrationTests/UserTests.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
using exercise.wwwapi.DTOs;
2-
using exercise.wwwapi.DTOs.Login;
1+
using exercise.wwwapi.DTOs.Login;
32
using exercise.wwwapi.DTOs.Register;
4-
using exercise.wwwapi.Models;
5-
using Microsoft.AspNetCore.Http;
63
using Microsoft.AspNetCore.Mvc.Testing;
74
using System.Net;
85
using System.Text;
@@ -34,14 +31,15 @@ public void TearDown()
3431
}
3532

3633
// ad test cases for approved usernames, emails
37-
[Test, TestCaseSource(typeof(UserTestCases), nameof(UserTestCases.ValidRegisterCases))]
34+
[Test, TestCaseSource(typeof(UserTestCases), nameof(UserTestCases.ValidRegisterCases))]
3835
public async Task Register_success(string username, string email, string password)
3936
{
4037
var uniqueId = DateTime.UtcNow.ToString("yyMMddHHmmssffff");
4138

4239
string uniqueUsername = username.Length > 0 ? username + uniqueId : "";
4340

44-
RegisterRequestDTO body = new RegisterRequestDTO {
41+
RegisterRequestDTO body = new RegisterRequestDTO
42+
{
4543
email = $"{uniqueId}{email}",
4644
password = password
4745
};
@@ -77,7 +75,7 @@ public async Task Register_Failure(string username, string email, string passwor
7775
email = $"{uniqueId}{email}",
7876
password = password
7977
};
80-
78+
8179
var json = JsonSerializer.Serialize(body);
8280
var requestBody = new StringContent(json, Encoding.UTF8, "application/json");
8381

@@ -186,7 +184,7 @@ public async Task UpdateUserSuccess()
186184
[Test]
187185
public async Task UpdateUserNullFieldsOnly()
188186
{
189-
var fieldsToUpdate = new Dictionary<string, object?>{};
187+
var fieldsToUpdate = new Dictionary<string, object?> { };
190188

191189
var json = JsonSerializer.Serialize(fieldsToUpdate);
192190
var content = new StringContent(json, Encoding.UTF8, "application/json");

exercise.tests/IntegrationTests/ValidationTests.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
using exercise.tests.Helpers;
22
using exercise.wwwapi.DTOs.Validation;
3-
using Microsoft.AspNetCore.Http;
43
using Microsoft.AspNetCore.Mvc.Testing;
5-
using Microsoft.VisualStudio.TestPlatform.TestHost;
64
using System.Net;
7-
using System.Net.Http.Json;
8-
using System.Numerics;
95
using System.Text;
106
using System.Text.Json;
117
using System.Text.Json.Nodes;
@@ -32,11 +28,11 @@ public void TearDown()
3228
_factory.Dispose();
3329
}
3430

35-
[TestCase("Valid123!", HttpStatusCode.OK)]
36-
[TestCase("short1!", HttpStatusCode.BadRequest)]
37-
[TestCase("noupper123!", HttpStatusCode.BadRequest)]
38-
[TestCase("NoNumber!", HttpStatusCode.BadRequest)]
39-
[TestCase("NoSpecial1", HttpStatusCode.BadRequest)]
31+
[TestCase("Valid123!", HttpStatusCode.OK)]
32+
[TestCase("short1!", HttpStatusCode.BadRequest)]
33+
[TestCase("noupper123!", HttpStatusCode.BadRequest)]
34+
[TestCase("NoNumber!", HttpStatusCode.BadRequest)]
35+
[TestCase("NoSpecial1", HttpStatusCode.BadRequest)]
4036
[TestCase("V3rySp3ci&l", HttpStatusCode.OK)]
4137
[TestCase("", HttpStatusCode.BadRequest)]
4238
[TestCase(null!, HttpStatusCode.BadRequest)]
@@ -74,7 +70,7 @@ public async Task ValidatePasswordMessage(string? input, string expected)
7470

7571
// Act
7672
var response = await _client.PostAsync("/validation/password", requestBody);
77-
Console.WriteLine("r,",response);
73+
Console.WriteLine("r,", response);
7874

7975
// Assert
8076
var contentString = await response.Content.ReadAsStringAsync();

exercise.wwwapi/DTOs/GetUsers/UserBasicDTO.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ public class UserBasicDTO
55
public int Id { get; set; }
66
public string? FirstName { get; set; }
77
public string? LastName { get; set; }
8-
public string? Photo { get; set; }
8+
public string? Photo { get; set; }
99
}
1010
}

exercise.wwwapi/DTOs/Login/LoginRequestDTO.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ namespace exercise.wwwapi.DTOs.Login
66
public class LoginRequestDTO
77
{
88
public string? email { get; set; }
9-
public string? password { get; set; }
9+
public string? password { get; set; }
1010
}
1111
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
using exercise.wwwapi.Models;
2-
3-
namespace exercise.wwwapi.DTOs.Login
1+
namespace exercise.wwwapi.DTOs.Login
42
{
53
public class LoginSuccessDTO
64
{
75
public required string Token { get; set; }
8-
public required UserDTO User { get; set; }
6+
public required UserDTO User { get; set; }
97
}
108
}

exercise.wwwapi/DTOs/Posts/CreatePostDTO.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using exercise.wwwapi.DTOs.GetUsers;
2-
using exercise.wwwapi.Models;
3-
using System.ComponentModel.DataAnnotations;
4-
using System.ComponentModel.DataAnnotations.Schema;
5-
6-
namespace exercise.wwwapi.DTOs.Posts
1+
namespace exercise.wwwapi.DTOs.Posts
72
{
83
public class CreatePostDTO
94
{

0 commit comments

Comments
 (0)