private void ValidateFunction(SdkFunctionMetadata sdkFunctionMetadata, string name, string entryPoint, params Action <ExpandoObject>[] bindingValidations)
        {
            Assert.Equal(name, sdkFunctionMetadata.Name);
            Assert.Equal($"bin/{_thisAssembly.GetName().Name}.dll", sdkFunctionMetadata.ScriptFile);
            Assert.Equal("dotnet-isolated", sdkFunctionMetadata.Language);
            Assert.Equal(sdkFunctionMetadata.EntryPoint, entryPoint);
            Assert.Null(sdkFunctionMetadata.FunctionDirectory);

            Assert.Single(sdkFunctionMetadata.Properties, p => p.Key == "IsCodeless" && p.Value.ToString() == "False");

            Assert.Collection(sdkFunctionMetadata.Bindings, bindingValidations);
        }
        public void CardinalityManyFunctions(string functionName, string entryPoint, bool cardinalityMany, string dataType)
        {
            var generator  = new FunctionMetadataGenerator();
            var typeDef    = TestUtility.GetTypeDefinition(typeof(CardinalityMany));
            var functions  = generator.GenerateFunctionMetadata(typeDef);
            var extensions = generator.Extensions;

            SdkFunctionMetadata metadata = functions.Where(a => string.Equals(a.Name, functionName, StringComparison.Ordinal)).Single();

            ValidateFunction(metadata, functionName, GetEntryPoint(nameof(CardinalityMany), entryPoint),
                             b => ValidateTrigger(b, cardinalityMany));

            AssertDictionary(extensions, new Dictionary <string, string>()
            {
                { "Microsoft.Azure.WebJobs.Extensions.EventHubs", "4.2.0" }
            });

            void ValidateTrigger(ExpandoObject b, bool many)
            {
                var expected = new Dictionary <string, object>()
                {
                    { "Name", "input" },
                    { "Type", "EventHubTrigger" },
                    { "Direction", "In" },
                    { "eventHubName", "test" },
                    { "Connection", "EventHubConnectionAppSetting" }
                };

                if (many)
                {
                    expected.Add("Cardinality", "Many");
                }
                else
                {
                    expected.Add("Cardinality", "One");
                }

                if (!string.IsNullOrEmpty(dataType))
                {
                    expected.Add("DataType", dataType);
                }

                AssertExpandoObject(b, expected);
            }
        }