コード例 #1
0
        public void GetErrorDetailsDataType_WhenErrorIsNull_CallsBase()
        {
            using (var rpc = new TestJsonRpc())
            {
                Type type = rpc.GetErrorDetailsDataTypeHelper(error: null);

                Assert.Equal(typeof(CommonErrorData), type);
            }
        }
コード例 #2
0
        public void GetErrorDetailsDataType_WhenErrorIsNull_CallsBase()
        {
            using (var rpc = new TestJsonRpc())
            {
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
                Type?type = rpc.GetErrorDetailsDataTypeHelper(error: null);
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.

                Assert.Equal(typeof(CommonErrorData), type);
            }
        }
コード例 #3
0
        public void GetErrorDetailsDataType_WhenErrorPropertyIsNull_CallsBase()
        {
            using (var rpc = new TestJsonRpc())
            {
                Type?type = rpc.GetErrorDetailsDataTypeHelper(
                    new JsonRpcError()
                {
                    Error = null
                });

                Assert.Equal(typeof(CommonErrorData), type);
            }
        }
コード例 #4
0
        public void GetErrorDetailsDataType_WhenErrorCodePropertyIsAMatch_ReturnsRemoteErrorType()
        {
            using (var rpc = new TestJsonRpc())
            {
                Type?type = rpc.GetErrorDetailsDataTypeHelper(
                    new JsonRpcError()
                {
                    Error = new JsonRpcError.ErrorDetail()
                    {
                        Code = (JsonRpcErrorCode)(int)RemoteErrorCode.RemoteError
                    }
                });

                Assert.Equal(typeof(RemoteError), type);
            }
        }
コード例 #5
0
        public void GetErrorDetailsDataType_WhenErrorCodePropertyIsNotAMatch_CallsBase()
        {
            using (var rpc = new TestJsonRpc())
            {
                Type?type = rpc.GetErrorDetailsDataTypeHelper(
                    new JsonRpcError()
                {
                    Error = new JsonRpcError.ErrorDetail()
                    {
                        Code = (JsonRpcErrorCode)int.MinValue
                    }
                });

                Assert.Equal(typeof(CommonErrorData), type);
            }
        }