Пример #1
0
        public void ResolveId_CreatesExpectedString(string token, string expected)
        {
            // Arrange
            ParameterInfo parameter = EasyTableTestHelper.GetValidInputItemParameters().First();

            var easyTableContext = new EasyTableContext()
            {
                ResolvedId = token
            };

            var bindingContract = new Dictionary <string, Type>();

            bindingContract.Add("MyItemId", typeof(string));

            var bindingProviderContext = new BindingProviderContext(parameter, bindingContract, CancellationToken.None);

            var binding = new EasyTableItemBinding(parameter, easyTableContext, bindingProviderContext);

            var bindingData = new Dictionary <string, object>();

            bindingData.Add("MyItemId", "abc123");

            // Act
            var resolved = binding.ResolveId(bindingData);

            // Assert
            Assert.Equal(expected, resolved);
        }
Пример #2
0
        public async Task BindAsync_Returns_CorrectValueProvider(ParameterInfo parameter, Type expectedType)
        {
            // Arrange
            var easyTableContext       = new EasyTableContext();
            var bindingProviderContext = new BindingProviderContext(parameter, null, CancellationToken.None);
            var binding = new EasyTableItemBinding(parameter, easyTableContext, bindingProviderContext);

            // Act
            var valueProvider = await binding.BindAsync("abc123", null);

            // Assert
            Assert.Equal(expectedType, valueProvider.GetType());
        }