public async Task ThenShouldReturnBinding()
        {
            //Arrange
            var testMessage = new TestMessage {
                Name = "Test"
            };
            var messageText     = JsonConvert.SerializeObject(testMessage);
            var messageTextData = Encoding.UTF8.GetBytes(messageText);
            var triggerData     = new NServiceBusTriggerData
            {
                Data = messageTextData
            };

            //Act
            var result = await _binding.BindAsync(triggerData, new ValueBindingContext(
                                                      new FunctionBindingContext(Guid.NewGuid(), new CancellationToken()),
                                                      new CancellationToken()));

            //Assert
            Assert.IsNotNull(result);

            var valueBinder = result.ValueProvider as NServiceBusMessageValueBinder;

            Assert.IsNotNull(valueBinder);

            var actualMessage = await valueBinder.GetValueAsync() as TestMessage;

            Assert.IsNotNull(actualMessage);
            Assert.AreEqual(testMessage.Name, actualMessage.Name);
        }
        public void ThenThrowsExceptionIfValueCannotBeDeseriaised()
        {
            //Arrange
            var triggerData = new NServiceBusTriggerData
            {
                Data = new byte[] { 1, 2, 3 }
            };

            //Act + Assert
            var exception = Assert.ThrowsAsync <ArgumentException>(() => _binding.BindAsync(triggerData, new ValueBindingContext(
                                                                                                new FunctionBindingContext(Guid.NewGuid(), new CancellationToken()),
                                                                                                new CancellationToken())));

            Assert.AreEqual("value", exception.ParamName);
        }