< Summary

Class:DCL.Helpers.NFT.Markets.OpenSea_Internal.RequestBase[T]
Assembly:OpenSea_Internal
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/ServiceProviders/OpenSea/Requests/RequestBase.cs
Covered lines:0
Uncovered lines:13
Coverable lines:13
Total lines:32
Line coverage:0% (0 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Resolve(...)0%6200%
Reject(...)0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/ServiceProviders/OpenSea/Requests/RequestBase.cs

#LineLine coverage
 1using System;
 2
 3namespace DCL.Helpers.NFT.Markets.OpenSea_Internal
 4{
 5    public abstract class RequestBase<T>
 6    {
 7        public event Action<RequestBase<T>> OnSuccess;
 8        public event Action<RequestBase<T>> OnFail;
 9
 010        public bool resolved { private set; get; }
 011        public bool rejected { private set; get; }
 012        public bool pending => !rejected && !resolved;
 013        public string error { private set; get; }
 14        public abstract string requestId { get; }
 15
 016        public T resolvedValue { private set; get; }
 17
 18        public void Resolve(T response)
 19        {
 020            resolvedValue = response;
 021            resolved = true;
 022            OnSuccess?.Invoke(this);
 023        }
 24
 25        public void Reject(string error)
 26        {
 027            this.error = error;
 028            rejected = true;
 029            OnFail?.Invoke(this);
 030        }
 31    }
 32}