public void MetadataShouldBePublic()
 {
     AssertHelper.AssertThrows <InvalidOperationException>(() => {
         MetadataHelper.AddMetadata(typeof(PrivateMetadata));
     }, x => x.Message.AreEqual("The PrivateMetadata type should be public"));
     AssertHelper.AssertThrows <InvalidOperationException>(() => {
         MetadataLocator.Create().AddMetadata(typeof(PrivateMetadata));
     }, x => x.Message.AreEqual("The PrivateMetadata type should be public"));
 }
 public void InternalLocatorTest()
 {
     MetadataHelper.AddMetadata <TestDataMetadata>();
     try {
         Assert.IsFalse(GetExternalAndFluentAPIAttrbutes(typeof(TestData), "Prop1").OfType <DisplayAttribute>().Single().AutoGenerateField);
     } finally {
         MetadataHelper.ClearMetadata();
     }
 }
        public void InternalAndDefaultLocatorsPriorityTest()
        {
            var defaultLocator = MetadataLocator.Create()
                                 .AddMetadata <TestDataMetadataDefault>()
            ;

            MetadataLocator.Default = defaultLocator;
            MetadataHelper.AddMetadata <TestDataMetadata>();
            try {
                Assert.IsTrue(GetExternalAndFluentAPIAttrbutes(typeof(TestData), "Prop1").OfType <DisplayAttribute>().Single().AutoGenerateField);
            } finally {
                MetadataHelper.ClearMetadata();
                MetadataLocator.Default = null;
            }
        }