public void Request_NullOrEmptyServiceName_ShouldThrowArgumentNullException() { var fakeMDPClient = new MDPTestClientForTitanicClient(); var sut = new TitanicClient(fakeMDPClient); Assert.Throws <ArgumentNullException> (() => sut.Request(string.Empty, "Hello World")); }
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 ()); }
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 ()); }
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()); }
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()); }
public void Request_NullOrEmptyServiceName_ShouldThrowArgumentNullException () { var fakeMDPClient = new MDPTestClientForTitanicClient (); var sut = new TitanicClient (fakeMDPClient); Assert.Throws<ArgumentNullException> (() => sut.Request (string.Empty, "Hello World")); }