Пример #1
0
        public void GetCustomAttributes_WithReadWriteTypes_AppliesReadWriteAccess(Type parameterType, FileAccess metadataAccess, FileAccess expectedAccess)
        {
            var metadata = new BlobBindingMetadata()
            {
                Path = "my/blob"
            };
            var binding = new BlobBinding(new ScriptHostConfiguration(), metadata, metadataAccess);

            Collection <CustomAttributeBuilder> attributeBuilders = binding.GetCustomAttributes(parameterType);

            // Get blob attribute
            var builder = attributeBuilders.FirstOrDefault(b =>
                                                           string.CompareOrdinal(GetCustomAttributeBuilderFieldValue <ConstructorInfo>("m_con", b).DeclaringType.FullName,
                                                                                 "Microsoft.Azure.WebJobs.BlobAttribute") == 0);

            Assert.NotNull(builder);

            var attributeParameters = GetCustomAttributeBuilderFieldValue <object[]>("m_constructorArgs", builder);

            Assert.Equal(2, attributeParameters.Length);
            Assert.IsType(typeof(FileAccess), attributeParameters[1]);

            FileAccess access = (FileAccess)attributeParameters[1];

            Assert.Equal(expectedAccess, access);
        }
Пример #2
0
 public void VisitBlob(BlobBinding <T> blobBinding)
 {
     blobBinding.Bind(this.input);
     Console.WriteLine(" to output");
 }