Exemplo n.º 1
0
        public void ResourceSetNamesMustBeUniqueTest()
        {
            var metadataProvider = new ResourceSetsOverrideMetadataProvider("Test", "TestNS");

            metadataProvider.ResourceSetValues = new List <ResourceSet>();
            var type = metadataProvider.AddEntityType("EntityType", null, null, false);

            metadataProvider.ResourceSetValues.Add(new ResourceSet("Entities", type));
            metadataProvider.ResourceSetValues.Add(new ResourceSet("Entities", type));
            var wrapper = new DataServiceMetadataProviderWrapper(metadataProvider);

            ExceptionUtils.ExpectedException <DataServiceException>(
                () => wrapper.ResourceSets.Cast <object>().Count(),
                "The resource set 'Entities' returned by the provider is not read-only. Please make sure that all the resource sets are set to read-only.",
                "Two resource sets with the same name should fail in the wrapper.");
        }
 public void ResourceSetNamesMustBeUniqueTest()
 {
     var metadataProvider = new ResourceSetsOverrideMetadataProvider("Test", "TestNS");
     metadataProvider.ResourceSetValues = new List<ResourceSet>();
     var type = metadataProvider.AddEntityType("EntityType", null, null, false);
     metadataProvider.ResourceSetValues.Add(new ResourceSet("Entities", type));
     metadataProvider.ResourceSetValues.Add(new ResourceSet("Entities", type));
     var wrapper = new DataServiceMetadataProviderWrapper(metadataProvider);
     ExceptionUtils.ExpectedException<DataServiceException>(
         () => wrapper.ResourceSets.Cast<object>().Count(),
         "The resource set 'Entities' returned by the provider is not read-only. Please make sure that all the resource sets are set to read-only.",
         "Two resource sets with the same name should fail in the wrapper.");
 }