< Summary

Information
Class: ClutterStock.Domain.Features.Locations.AddLocation.AddLocationEndpoint
Assembly: Domain
File(s): /home/runner/work/ClutterStock/ClutterStock/backend/src/Domain/Features/Locations/AddLocation/AddLocationEndpoint.cs
Tag: 58_25416222083
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 26
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Route()100%11100%
get_Handler()100%22100%
Handle()100%11100%

File(s)

/home/runner/work/ClutterStock/ClutterStock/backend/src/Domain/Features/Locations/AddLocation/AddLocationEndpoint.cs

#LineLine coverage
 1using ClutterStock.Contracts.Locations;
 2using ClutterStock.Domain.Abstractions;
 3using ClutterStock.Domain.Extensions;
 4using Microsoft.AspNetCore.Http;
 5using Microsoft.AspNetCore.Http.HttpResults;
 6using Microsoft.AspNetCore.Mvc;
 7
 8namespace ClutterStock.Domain.Features.Locations.AddLocation;
 9
 10[HttpMethod(HttpVerb.Post)]
 11[OpenApiDescription("Creates a new location.")]
 12public class AddLocationEndpoint : IEndpoint
 13{
 314    public static string Route => "/locations";
 15
 316    public static Delegate Handler => (Func<AddLocationRequest, IAddLocationCommandHandler, CancellationToken, Task<Crea
 17
 18    private static async Task<Created<LocationResponse>> Handle([FromBody] AddLocationRequest request,
 19                                                                IAddLocationCommandHandler handler,
 20                                                                CancellationToken cancellationToken)
 21    {
 422        var command = new IAddLocationCommandHandler.Command(request.Name, request.Description);
 423        var location = await handler.HandleAsync(command, cancellationToken);
 424        return TypedResults.Created($"/locations/{location.Id}", location.ToResponse());
 425    }
 26}

Methods/Properties

get_Route()
get_Handler()
Handle()