-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V9.0.0/depedency bump #3
Changes from all commits
e69e12b
26f6a15
7dda07e
bd540af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json.Assets | ||
{ | ||
public class SampleModel | ||
{ | ||
[Required(ErrorMessage = "This field is required.")] | ||
[StringLength(100)] | ||
public string Name { get; set; } | ||
} | ||
} | ||
Comment on lines
+5
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider enhancing the model for improved testability. While the current implementation is sufficient for basic testing, consider the following enhancements to improve the model's usability in tests:
Here's an example of how you could implement these suggestions: public class SampleModel
{
[Required(ErrorMessage = "This field is required.")]
[StringLength(100, ErrorMessage = "The name cannot exceed 100 characters.")]
public string Name { get; set; }
public SampleModel() { }
public SampleModel(string name)
{
Name = name;
}
public override string ToString()
{
return $"SampleModel {{ Name = {Name} }}";
}
} These additions would make the model more versatile for various testing scenarios. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
using System; | ||
using System.Reflection; | ||
using Cuemon.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Codebelt.Extensions.AspNetCore.Mvc.Formatters.Newtonsoft.Json.Assets | ||
{ | ||
[ApiController] | ||
[Route("[controller]")] | ||
public class StatusCodesController : ControllerBase | ||
{ | ||
[HttpGet("400")] | ||
public IActionResult Get_400() | ||
{ | ||
throw new BadRequestException(new ArgumentNullException()); | ||
} | ||
|
||
[HttpGet("401")] | ||
public IActionResult Get_401() | ||
{ | ||
throw new UnauthorizedException(new AccessViolationException()); | ||
} | ||
|
||
[HttpGet("403")] | ||
public IActionResult Get_403() | ||
{ | ||
throw new ForbiddenException(new UnauthorizedAccessException()); | ||
} | ||
|
||
[HttpGet("404")] | ||
public IActionResult Get_404() | ||
{ | ||
throw new NotFoundException(new NullReferenceException()); | ||
} | ||
|
||
[HttpGet("405")] | ||
public IActionResult Get_405() | ||
{ | ||
throw new MethodNotAllowedException(new ArgumentException()); | ||
} | ||
|
||
[HttpGet("406")] | ||
public IActionResult Get_406() | ||
{ | ||
throw new NotAcceptableException(new ArgumentException()); | ||
} | ||
|
||
[HttpGet("409")] | ||
public IActionResult Get_409() | ||
{ | ||
throw new ConflictException(new AmbiguousMatchException()); | ||
} | ||
|
||
[HttpGet("410")] | ||
public IActionResult Get_410() | ||
{ | ||
throw new GoneException(new NotImplementedException()); | ||
} | ||
|
||
[HttpGet("412")] | ||
public IActionResult Get_412() | ||
{ | ||
throw new PreconditionFailedException(new ArgumentOutOfRangeException()); | ||
} | ||
|
||
[HttpGet("413")] | ||
public IActionResult Get_413() | ||
{ | ||
throw new PayloadTooLargeException(new ArgumentOutOfRangeException()); | ||
} | ||
|
||
[HttpGet("415")] | ||
public IActionResult Get_415() | ||
{ | ||
throw new UnsupportedMediaTypeException(new ArgumentOutOfRangeException()); | ||
} | ||
|
||
[HttpGet("428")] | ||
public IActionResult Get_428() | ||
{ | ||
throw new PreconditionRequiredException(new ArgumentException()); | ||
} | ||
|
||
[HttpGet("429")] | ||
public IActionResult Get_429() | ||
{ | ||
throw new TooManyRequestsException(new OverflowException()); | ||
} | ||
|
||
[HttpGet("XXX/{app}")] | ||
public IActionResult Get_XXX(string app) | ||
{ | ||
try | ||
{ | ||
throw new ArgumentException("This is an inner exception message ...", nameof(app)) | ||
{ | ||
Data = | ||
{ | ||
{ nameof(app), app } | ||
}, | ||
HelpLink = "https://www.savvyio.net/" | ||
}; | ||
} | ||
catch (Exception e) | ||
{ | ||
throw new NotSupportedException("Main exception - look out for inner!", e); | ||
} | ||
} | ||
|
||
[HttpPost("/")] | ||
public IActionResult Post(SampleModel model) | ||
{ | ||
return Ok(model); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Residual 'Cuemon' references found in project files.
Several project files still reference "Cuemon" outside of expected PackageReference contexts:
test/Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Tests/Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Tests.csproj
:<PackageReference Include="Cuemon.Extensions.AspNetCore.Authentication" Version="9.0.0-preview.9" />
src/Codebelt.Extensions.AspNetCore.Newtonsoft.Json/Codebelt.Extensions.AspNetCore.Newtonsoft.Json.csproj
:<PackageReference Include="Cuemon.Core" Version="9.0.0-preview.9" />
<PackageReference Include="Cuemon.IO" Version="9.0.0-preview.9" />
<Description>...complements the Cuemon.Extensions.AspNetCore/Cuemon.Extensions.Newtonsoft.Json namespace...</Description>
Please update these references to "Codebelt" to ensure complete namespace restructuring.
🔗 Analysis chain
Namespace update in Description looks good.
The change from "Cuemon" to "Codebelt" in the namespace references is consistent with the PR objectives. This appears to be part of a larger rebranding or restructuring effort.
Let's verify if there are any remaining occurrences of "Cuemon" in the project files that might need updating:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 5164