< Summary

Class:SharpHoundRPC.NetAPINative.NetAPIResult<T>
Assembly:SharpHoundRPC
File(s):D:\a\SharpHoundCommon\SharpHoundCommon\src\SharpHoundRPC\NetAPINative\NetAPIResult.cs
Covered lines:25
Uncovered lines:3
Coverable lines:28
Total lines:49
Line coverage:89.2% (25 of 28)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
Ok(...)100%10100%
Fail(...)100%10100%
Fail(...)100%10100%
op_Implicit(...)100%10100%
op_Implicit(...)100%10100%
op_Implicit(...)100%100%
GetErrorStatus()100%20100%

File(s)

D:\a\SharpHoundCommon\SharpHoundCommon\src\SharpHoundRPC\NetAPINative\NetAPIResult.cs

#LineLine coverage
 1namespace SharpHoundRPC.NetAPINative
 2{
 3    public class NetAPIResult<T>
 4    {
 195        public bool IsSuccess { get; private set; }
 146        public NetAPIEnums.NetAPIStatus Status { get; private set; }
 147        public T Value { get; private set; }
 88        public string Error { get; private set; }
 109        public bool IsFailed => !IsSuccess;
 10
 11        public static NetAPIResult<T> Ok(T value)
 812        {
 813            return new NetAPIResult<T> {IsSuccess = true, Value = value};
 814        }
 15
 16        public static NetAPIResult<T> Fail(NetAPIEnums.NetAPIStatus status)
 317        {
 318            return new NetAPIResult<T> {Status = status};
 319        }
 20
 21        public static NetAPIResult<T> Fail(string error)
 222        {
 223            return new NetAPIResult<T> {Error = error};
 224        }
 25
 26        public static implicit operator NetAPIResult<T>(T input)
 827        {
 828            return Ok(input);
 829        }
 30
 31        public static implicit operator NetAPIResult<T>(NetAPIEnums.NetAPIStatus status)
 332        {
 333            return Fail(status);
 334        }
 35
 36        public static implicit operator NetAPIResult<T>(string error)
 037        {
 038            return Fail(error);
 039        }
 40
 441        public string GetErrorStatus() {
 642            if (!string.IsNullOrEmpty(Error)) {
 243                return Error;
 44            }
 45
 246            return Status.ToString();
 447        }
 48    }
 49}