Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Commit 250959d

Browse files
committed
Updated documentation;
Cleaned and normalized code;
1 parent 4e8f15e commit 250959d

7 files changed

Lines changed: 504 additions & 49 deletions

File tree

.editorconfig

Lines changed: 443 additions & 0 deletions
Large diffs are not rendered by default.

PowerUtils.Net.Primitives.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project", "Project", "{BECA00C2-6FEE-416B-BF8A-DFBFC067ED21}"
77
ProjectSection(SolutionItems) = preProject
8+
.editorconfig = .editorconfig
89
.gitignore = .gitignore
910
global.json = global.json
1011
LICENSE = LICENSE

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,11 @@ dotnet add package PowerUtils.Net.Primitives
100100
## Release Notes
101101

102102

103+
### v1.0.1 - ???
104+
105+
#### Enhancements
106+
- Updated documentation;
107+
108+
103109
### v1.0.0 - 2021/11/21
104110
- Kick start project

src/.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[*.cs]
2+
3+
4+
###############################
5+
# C# Coding Conventions #
6+
###############################
7+
8+
9+
# Code-block preferences
10+
csharp_style_namespace_declarations = block_scoped:suggestion # https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_style_namespace_declarations

src/1.PowerUtils.Net.Primitives.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<!-- Assembly and projecto details -->
@@ -24,7 +24,7 @@
2424

2525
<Description>Provides additional types and constants for network-based libraries.</Description>
2626
<PackageReleaseNotes>
27-
- Kick start project
27+
- Updated documentation;
2828
</PackageReleaseNotes>
2929
<Description>Provides additional types and constants for network-based libraries.</Description>
3030
<PackageTags>PowerUtils;Utils;Net;Primitives;Types;Constants;Web</PackageTags>

src/Constants/StatusCodeLink.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ public static class StatusCodeLink
4040
/// <summary>
4141
/// Get documentation link by status code
4242
/// </summary>
43-
/// <param name="statuCode"></param>
43+
/// <param name="statuCode">Http statu code</param>
4444
/// <exception cref="ArgumentException">The <paramref name="statuCode">info</paramref> parameter does not exist.</exception>
4545
/// <returns>Documentation link</returns>
4646
public static string GetStatusCodeLink(this int statuCode)
47-
{
48-
return statuCode switch
47+
=> statuCode switch
4948
{
5049
// 4XX
5150
400 => BAD_REQUEST,
@@ -78,21 +77,18 @@ public static string GetStatusCodeLink(this int statuCode)
7877

7978
_ => throw new ArgumentException($"Unknown status code: '{statuCode}'"),
8079
};
81-
}
8280

8381
/// <summary>
8482
/// Get documentation link by status code
8583
/// </summary>
86-
/// <param name="statuCode"></param>
84+
/// <param name="statuCode">Http statu code</param>
8785
/// <exception cref="ArgumentException">The <paramref name="statuCode">info</paramref> parameter does not exist.</exception>
8886
/// <returns>Documentation link</returns>
8987
public static string GetStatusCodeLink(this int? statuCode)
90-
{
91-
return statuCode switch
88+
=> statuCode switch
9289
{
9390
null => STATUS_CODES,
9491
_ => statuCode.Value.GetStatusCodeLink(),
9592
};
96-
}
9793
}
98-
}
94+
}

tests/ConstantsTests/StatusCodeLinksTests.cs

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,44 @@
22
using PowerUtils.Net.Constants;
33
using Xunit;
44

5-
namespace PowerUtils.RestAPI.Tests.ProblemDetails
5+
namespace PowerUtils.RestAPI.Tests.ProblemDetails;
6+
7+
[Trait("Category", "Contains")]
8+
public class StatusCodeLinksTests
69
{
7-
[Trait("Category", "Contains")]
8-
public class StatusCodeLinksTests
10+
[Theory(DisplayName = "Http status codes - Should return the links")]
11+
[InlineData(null, StatusCodeLink.STATUS_CODES)]
12+
[InlineData(400, StatusCodeLink.BAD_REQUEST)]
13+
[InlineData(401, StatusCodeLink.UNAUTHORIZED)]
14+
[InlineData(402, StatusCodeLink.PAYMENT_REQUIRED)]
15+
[InlineData(403, StatusCodeLink.FORBIDDEN)]
16+
[InlineData(404, StatusCodeLink.NOT_FOUND)]
17+
[InlineData(405, StatusCodeLink.METHOD_NOT_ALLOWED)]
18+
[InlineData(406, StatusCodeLink.NOT_ACCEPTABLE)]
19+
[InlineData(407, StatusCodeLink.PROXY_AUTHENTICATION_REQUIRED)]
20+
[InlineData(408, StatusCodeLink.REQUEST_TIMEOUT)]
21+
[InlineData(409, StatusCodeLink.CONFLICT)]
22+
[InlineData(410, StatusCodeLink.GONE)]
23+
[InlineData(411, StatusCodeLink.LENGTH_REQUIRED)]
24+
[InlineData(412, StatusCodeLink.PRECONDITION_FAILED)]
25+
[InlineData(413, StatusCodeLink.REQUEST_ENTITY_TOO_LARGE)]
26+
[InlineData(414, StatusCodeLink.REQUEST_URI_TOO_LONG)]
27+
[InlineData(415, StatusCodeLink.UNSUPPORTED_MEDIA_TYPE)]
28+
[InlineData(416, StatusCodeLink.REQUESTED_RANGE_NOT_SATISFIABLE)]
29+
[InlineData(417, StatusCodeLink.EXPECTATION_FAILED)]
30+
[InlineData(426, StatusCodeLink.UPGRADE_REQUIRED)]
31+
[InlineData(500, StatusCodeLink.INTERNAL_SERVER_ERROR)]
32+
[InlineData(501, StatusCodeLink.NOT_IMPLEMENTED)]
33+
[InlineData(502, StatusCodeLink.BAD_GATEWAY)]
34+
[InlineData(503, StatusCodeLink.SERVICE_UNAVAILABLE)]
35+
[InlineData(504, StatusCodeLink.GATEWAY_TIMEOUT)]
36+
[InlineData(505, StatusCodeLink.HTTP_VERSION_NOT_SUPPORTED)]
37+
public void GetStatusCodeLink_StatusCodes_ReturnLinks(int? statusCode, string statusCodeLink)
938
{
10-
[Theory(DisplayName = "Http status codes - Should return the links")]
11-
[InlineData(null, StatusCodeLink.STATUS_CODES)]
12-
[InlineData(400, StatusCodeLink.BAD_REQUEST)]
13-
[InlineData(401, StatusCodeLink.UNAUTHORIZED)]
14-
[InlineData(402, StatusCodeLink.PAYMENT_REQUIRED)]
15-
[InlineData(403, StatusCodeLink.FORBIDDEN)]
16-
[InlineData(404, StatusCodeLink.NOT_FOUND)]
17-
[InlineData(405, StatusCodeLink.METHOD_NOT_ALLOWED)]
18-
[InlineData(406, StatusCodeLink.NOT_ACCEPTABLE)]
19-
[InlineData(407, StatusCodeLink.PROXY_AUTHENTICATION_REQUIRED)]
20-
[InlineData(408, StatusCodeLink.REQUEST_TIMEOUT)]
21-
[InlineData(409, StatusCodeLink.CONFLICT)]
22-
[InlineData(410, StatusCodeLink.GONE)]
23-
[InlineData(411, StatusCodeLink.LENGTH_REQUIRED)]
24-
[InlineData(412, StatusCodeLink.PRECONDITION_FAILED)]
25-
[InlineData(413, StatusCodeLink.REQUEST_ENTITY_TOO_LARGE)]
26-
[InlineData(414, StatusCodeLink.REQUEST_URI_TOO_LONG)]
27-
[InlineData(415, StatusCodeLink.UNSUPPORTED_MEDIA_TYPE)]
28-
[InlineData(416, StatusCodeLink.REQUESTED_RANGE_NOT_SATISFIABLE)]
29-
[InlineData(417, StatusCodeLink.EXPECTATION_FAILED)]
30-
[InlineData(426, StatusCodeLink.UPGRADE_REQUIRED)]
31-
[InlineData(500, StatusCodeLink.INTERNAL_SERVER_ERROR)]
32-
[InlineData(501, StatusCodeLink.NOT_IMPLEMENTED)]
33-
[InlineData(502, StatusCodeLink.BAD_GATEWAY)]
34-
[InlineData(503, StatusCodeLink.SERVICE_UNAVAILABLE)]
35-
[InlineData(504, StatusCodeLink.GATEWAY_TIMEOUT)]
36-
[InlineData(505, StatusCodeLink.HTTP_VERSION_NOT_SUPPORTED)]
37-
public void GetStatusCodeLink_StatusCodes_ReturnLinks(int? statusCode, string statusCodeLink)
38-
{
39-
// Arrange & Act
40-
var act = statusCode.GetStatusCodeLink();
39+
// Arrange & Act
40+
var act = statusCode.GetStatusCodeLink();
4141

42-
// Assert
43-
act.Should().Be(statusCodeLink);
44-
}
42+
// Assert
43+
act.Should().Be(statusCodeLink);
4544
}
46-
}
45+
}

0 commit comments

Comments
 (0)