Esempio n. 1
0
        public void Request_NullOrEmptyServiceName_ShouldThrowArgumentNullException()
        {
            var fakeMDPClient = new MDPTestClientForTitanicClient();

            var sut = new TitanicClient(fakeMDPClient);

            Assert.Throws <ArgumentNullException> (() => sut.Request(string.Empty, "Hello World"));
        }
Esempio n. 2
0
        public void Request_ValidRequestStringGeneric_ShouldReturnExpectedGuid ()
        {
            var expectedId = Guid.NewGuid ();
            var replyMessage = new NetMQMessage ();

            replyMessage.Push (expectedId.ToString ());
            replyMessage.Push (TitanicReturnCode.Ok.ToString ());

            var fakeMDPClient = new MDPTestClientForTitanicClient { ReplyMessage = replyMessage, RequestId = expectedId };

            var generic = new TestEntity ();
            var sut = new TitanicClient (fakeMDPClient);
            var id = sut.Request ("echo", generic.ConvertToBytes ());

            id.Should ().Be (expectedId.ToString ());
        }
Esempio n. 3
0
        public void Request_ValidRequestStringBytes_ShouldReturnExpectedGuid ()
        {
            var expectedId = Guid.NewGuid ();
            var replyMessage = new NetMQMessage ();

            replyMessage.Push (expectedId.ToString ());
            replyMessage.Push (TitanicReturnCode.Ok.ToString ());

            var fakeMDPClient = new MDPTestClientForTitanicClient { ReplyMessage = replyMessage, RequestId = expectedId };


            var sut = new TitanicClient (fakeMDPClient);
            var id = sut.Request ("echo", Encoding.UTF8.GetBytes ("Hello World!"));

            id.Should ().Be (expectedId.ToString ());
        }
Esempio n. 4
0
        public void Request_ValidRequestStringGeneric_ShouldReturnExpectedGuid()
        {
            var expectedId   = Guid.NewGuid();
            var replyMessage = new NetMQMessage();

            replyMessage.Push(expectedId.ToString());
            replyMessage.Push(TitanicReturnCode.Ok.ToString());

            var fakeMDPClient = new MDPTestClientForTitanicClient {
                ReplyMessage = replyMessage, RequestId = expectedId
            };

            var generic = new TestEntity();
            var sut     = new TitanicClient(fakeMDPClient);
            var id      = sut.Request("echo", generic.ConvertToBytes());

            id.Should().Be(expectedId.ToString());
        }
Esempio n. 5
0
        public void Request_ValidRequestStringBytes_ShouldReturnExpectedGuid()
        {
            var expectedId   = Guid.NewGuid();
            var replyMessage = new NetMQMessage();

            replyMessage.Push(expectedId.ToString());
            replyMessage.Push(TitanicReturnCode.Ok.ToString());

            var fakeMDPClient = new MDPTestClientForTitanicClient {
                ReplyMessage = replyMessage, RequestId = expectedId
            };


            var sut = new TitanicClient(fakeMDPClient);
            var id  = sut.Request("echo", Encoding.UTF8.GetBytes("Hello World!"));

            id.Should().Be(expectedId.ToString());
        }
Esempio n. 6
0
        public void Request_NullOrEmptyServiceName_ShouldThrowArgumentNullException ()
        {
            var fakeMDPClient = new MDPTestClientForTitanicClient ();

            var sut = new TitanicClient (fakeMDPClient);

            Assert.Throws<ArgumentNullException> (() => sut.Request (string.Empty, "Hello World"));
        }