Пример #1
0
        public void Test_SetException(OperationCode operationCode, ResponseStatus status, ResponseStatus translatedStatus, Type exceptionType)
        {
            var code      = ((short)status).ToString("X").ToLower();
            var json      = ResourceHelper.ReadResource(@"Data\kv-error-map-v5.5.0.json");
            var errorMap  = JsonConvert.DeserializeObject <ErrorMap>(json);
            var errorCode = errorMap.Errors[code];

            var operation = new FakeOperation(operationCode, status, errorCode);
            var result    = operation.GetResult();

            ((OperationResult)result).SetException();

            Assert.AreEqual(translatedStatus, result.Status);
            Assert.IsInstanceOf(exceptionType, result.Exception);
        }