public void TestToException_RpcErrorMessagePackObject_NonDictionaryMesssagePackObject_Ignored()
        {
            var error  = RpcError.MessageRefusedError;
            var detail = "ABC";

            var target = new RpcErrorMessage(error, detail);
            var result = target.ToException();

            Assert.That(result.RpcError, Is.EqualTo(error));
            Assert.That(result.Message, Is.EqualTo(result.RpcError.DefaultMessageInvariant));
            Assert.That(result.DebugInformation, Is.Not.Null.And.Empty);
        }
        public void TestToException_RpcErrorStringString_NotNull_AsIs()
        {
            var error            = RpcError.MessageRefusedError;
            var message          = Guid.NewGuid().ToString();
            var debugInformation = Guid.NewGuid().ToString();

            var target = new RpcErrorMessage(error, message, debugInformation);
            var result = target.ToException();

            Assert.That(target.Error, Is.EqualTo(error));
            Assert.That(target.Detail.AsDictionary()[RpcException.MessageKeyUtf8].Equals(message));
            Assert.That(target.Detail.AsDictionary()[RpcException.DebugInformationKeyUtf8].Equals(debugInformation));
            Assert.That(target.IsSuccess, Is.False);
        }
        public void TestToException_RpcErrorMessagePackObject_DictionaryMesssagePackObject_AsIs()
        {
            var error            = RpcError.MessageRefusedError;
            var message          = Guid.NewGuid().ToString();
            var debugInformation = Guid.NewGuid().ToString();
            var detail           =
                new MessagePackObjectDictionary()
            {
                { RpcException.MessageKeyUtf8, message },
                { RpcException.DebugInformationKeyUtf8, debugInformation }
            };

            var target = new RpcErrorMessage(error, new MessagePackObject(detail));
            var result = target.ToException();

            Assert.That(result.RpcError, Is.EqualTo(error));
            Assert.That(result.Message, Is.EqualTo(message));
            Assert.That(result.DebugInformation, Is.EqualTo(debugInformation));
        }
Exemplo n.º 4
0
		public void TestToException_RpcErrorStringString_NotNull_AsIs()
		{
			var error = RpcError.MessageRefusedError;
			var message = Guid.NewGuid().ToString();
			var debugInformation = Guid.NewGuid().ToString();

			var target = new RpcErrorMessage( error, message, debugInformation );
			var result = target.ToException();

			Assert.That( target.Error, Is.EqualTo( error ) );
			Assert.That( target.Detail.AsDictionary()[ RpcException.MessageKeyUtf8 ].Equals( message ) );
			Assert.That( target.Detail.AsDictionary()[ RpcException.DebugInformationKeyUtf8 ].Equals( debugInformation ) );
			Assert.That( target.IsSuccess, Is.False );
		}
Exemplo n.º 5
0
		public void TestToException_RpcErrorMessagePackObject_DictionaryMesssagePackObject_AsIs()
		{
			var error = RpcError.MessageRefusedError;
			var message = Guid.NewGuid().ToString();
			var debugInformation = Guid.NewGuid().ToString();
			var detail =
				new MessagePackObjectDictionary()
				{
					{ RpcException.MessageKeyUtf8, message },
					{ RpcException.DebugInformationKeyUtf8, debugInformation }
				};

			var target = new RpcErrorMessage( error, new MessagePackObject( detail ) );
			var result = target.ToException();

			Assert.That( result.RpcError, Is.EqualTo( error ) );
			Assert.That( result.Message, Is.EqualTo( message ) );
			Assert.That( result.DebugInformation, Is.EqualTo( debugInformation ) );

		}
Exemplo n.º 6
0
		public void TestToException_RpcErrorMessagePackObject_NonDictionaryMesssagePackObject_Ignored()
		{
			var error = RpcError.MessageRefusedError;
			var detail = "ABC";

			var target = new RpcErrorMessage( error, detail );
			var result = target.ToException();

			Assert.That( result.RpcError, Is.EqualTo( error ) );
			Assert.That( result.Message, Is.EqualTo( result.RpcError.DefaultMessageInvariant ) );
			Assert.That( result.DebugInformation, Is.Not.Null.And.Empty );
		}