< Summary

Class:LambdaOutfitsService
Assembly:BackpackEditorHUDV2
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BackpackEditorHUDV2/Outfits/LambdaOutfitsService.cs
Covered lines:4
Uncovered lines:5
Coverable lines:9
Total lines:37
Line coverage:44.4% (4 of 9)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:2
Method coverage:50% (1 of 2)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
LambdaOutfitsService(...)0%110100%
RequestOwnedOutfits()0%20400%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BackpackEditorHUDV2/Outfits/LambdaOutfitsService.cs

#LineLine coverage
 1using Cysharp.Threading.Tasks;
 2using DCL;
 3using DCL.Backpack;
 4using DCLServices.Lambdas;
 5using System;
 6using System.Collections.Generic;
 7using System.Threading;
 8using UnityEngine;
 9
 10public class LambdaOutfitsService
 11{
 12    private const string OUTFITS_ENDPOINT = "outfits/";
 13    private readonly ILambdasService lambdasService;
 14    private ICatalyst catalyst;
 15
 2516    public LambdaOutfitsService(ILambdasService lambdasService, IServiceProviders serviceProviders)
 17    {
 2518        this.lambdasService = lambdasService;
 2519        this.catalyst = serviceProviders.catalyst;
 2520    }
 21
 22    public async UniTask<(IReadOnlyList<OutfitItem> outfits, int totalAmount)> RequestOwnedOutfits(
 23        string userId,
 24        CancellationToken cancellationToken)
 25    {
 026        (OutfitsResponse response, bool success) = await lambdasService.Get<OutfitsResponse>(
 27            OUTFITS_ENDPOINT + userId,
 28            OUTFITS_ENDPOINT + userId,
 29            cancellationToken: cancellationToken);
 30
 31
 032        if (!success)
 033            throw new Exception($"The request of outfits for '{userId}' failed!");
 34
 035        return (response.metadata.outfits, response.metadata.outfits.Length);
 036    }
 37}