Пример #1
0
        public async Task ReturnTheFunction(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify)
        {
            protocolVerify.SetupRequest(_anyObject);
            var functionName = await protocol.GetRequestFunctionAsync();

            var expectedFunctionName = _uri.PathAndQuery.Replace("/", string.Empty);

            functionName.Should().Be(expectedFunctionName);
        }
Пример #2
0
        public async Task ReturnTheRequest(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify)
        {
            protocolVerify.SetupRequest(_anyObject);
            var requestBytes = await protocol.ReadRequestAsync();

            var request = TestSerializer.Deserialize <AnyObject>(requestBytes);

            request.Should().BeOfType <AnyObject>();
            request.anyInt.Should().Be(_anyObject.anyInt);
            request.anyString.Should().Be(_anyObject.anyString);
        }
Пример #3
0
        public void ThrowArgumentNullException_WhenHeaderIsNull(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify)
        {
            Func <Task> action = async() => await protocol.SendResponseAsync(null, _anyByte);

            action.Should().Throw <ArgumentNullException>();
        }
Пример #4
0
        public void ThrowArgumentNullException_WhenContentIsEmpty(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify)
        {
            Func <Task> action = async() => await protocol.SendResponseAsync(DefaultStatusHeadersKeyValues, new byte[0]);

            action.Should().Throw <ArgumentNullException>();
        }
Пример #5
0
        public async Task SendResponse(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify)
        {
            await protocol.SendResponseAsync(DefaultStatusHeadersKeyValues, _anyByte);

            protocolVerify.DrainResponse();
        }
Пример #6
0
        public void ThrowTimeoutException_WhenNoRequestData(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify)
        {
            Func <Task> action = async() => await protocol.ReadRequestAsync();

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