コード例 #1
0
        public void ReturnBytes(nRpc.Serializer serializer)
        {
            var result = serializer.Serialize(new AnyObject());

            result.Should().NotBeNull();
            result.Length.Should().NotBe(0);
        }
コード例 #2
0
        public void ReturnType(nRpc.Serializer serializer)
        {
            var serialized = serializer.Serialize(new AnyObject());
            var result     = serializer.Deserialize <AnyObject>(serialized);

            result.Should().BeOfType <AnyObject>();
            result.Should().NotBeNull();
        }
コード例 #3
0
        public async Task ReturnTheResponseMessage()
        {
            var protocolMock = new Mock <Protocol.TransferProtocolSender>();

            protocolMock.Setup(p => p.Send(It.IsAny <string>(), It.IsAny <byte[]>())).ReturnsAsync(TestSerializer.Serialize(_anyObject));

            var client   = new nRpc.Client(_hostUri, protocolMock.Object, TestSerializer);
            var response = await client.Call(new Procedure <object, AnyObject>("AnyName")
                                             , new object());

            response.Should().BeOfType <AnyObject>();
            response.anyInt.Should().Be(_anyObject.anyInt);
            response.anyString.Should().Be(_anyObject.anyString);
        }
コード例 #4
0
        public void ThrowArgumentNullException_WhenObjectIsNull(nRpc.Serializer serializer)
        {
            Action action = () => serializer.Serialize(null);

            action.Should().Throw <ArgumentNullException>();
        }