< Summary

Information
Class: ClutterStock.Domain.Features.Locations.UpdateLocation.UpdateLocationEndpoint
Assembly: Domain
File(s): /home/runner/work/ClutterStock/ClutterStock/backend/src/Domain/Features/Locations/UpdateLocation/UpdateLocationEndpoint.cs
Tag: 58_25416222083
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 25
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/UpdateLocation/UpdateLocationEndpoint.cs

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using ClutterStock.Contracts.Locations;
 3using ClutterStock.Domain.Abstractions;
 4using Microsoft.AspNetCore.Http.HttpResults;
 5using Microsoft.AspNetCore.Mvc;
 6
 7namespace ClutterStock.Domain.Features.Locations.UpdateLocation;
 8
 9[HttpMethod(HttpVerb.Put)]
 10[OpenApiDescription("Updates an existing location by id.")]
 11public class UpdateLocationEndpoint : IEndpoint
 12{
 313    public static string Route => "/locations/{id}";
 14
 315    public static Delegate Handler => (Func<int, UpdateLocationRequest, IUpdateLocationCommandHandler, CancellationToken
 16
 17    private static async Task<Results<Ok<LocationResponse>, NotFound>> Handle([FromRoute, Range(1, int.MaxValue)] int id
 18                                                                              [FromBody] UpdateLocationRequest request,
 19                                                                              IUpdateLocationCommandHandler handler,
 20                                                                              CancellationToken cancellationToken)
 21    {
 222        var command = new IUpdateLocationCommandHandler.Command(id, request.Name, request.Description);
 223        return await handler.HandleAsync(command, cancellationToken);
 224    }
 25}

Methods/Properties

get_Route()
get_Handler()
Handle()