Esempio n. 1
0
        public void ServiceOperationsMustBeReadOnlyTest()
        {
            var serviceOperationEntryPoints = new Action <DataServiceMetadataProviderWrapper, string>[] {
                (wrapper, name) => wrapper.TryResolveServiceOperation(name),
            };

            AstoriaTestNS.TestUtil.RunCombinations(
                serviceOperationEntryPoints,
                (serviceOperationEntryPoint) =>
            {
                var metadataProvider = new DSPMetadata("Test", "TestNS");
                var serviceOperation = metadataProvider.AddServiceOperation("ServiceOperation", ServiceOperationResultKind.DirectValue, ResourceType.GetPrimitiveResourceType(typeof(string)), null, "GET", new ServiceOperationParameter[0]);
                var wrapper          = new DataServiceMetadataProviderWrapper(metadataProvider);
                ExceptionUtils.ExpectedException <DataServiceException>(
                    () => serviceOperationEntryPoint(wrapper, serviceOperation.Name),
                    "The service operation '" + serviceOperation.Name + "' returned by the provider is not read-only. Please make sure that all the service operations are set to read-only.",
                    "Accessing writable service operation should fail.");
            });
        }