コード例 #1
0
        public void TestCopyPropertiesFromServiceConfigurationToUserSettings()
        {
            var serviceConfig = CreateServiceConfiguration();

            var userSettings = new UserSettings(configName: "TestUserSettings");

            userSettings.CopyPropertiesFrom(serviceConfig);

            Assert.Equal("Key:Test", userSettings.CustomHttpHeaders);
            Assert.True(userSettings.EnableNamingAlias);
            Assert.Equal("http://test", userSettings.Endpoint);
            Assert.Single(userSettings.ExcludedBoundOperations, "TestBoundOperation");
            Assert.Single(userSettings.ExcludedOperationImports, "TestOperationImport");
            Assert.Single(userSettings.ExcludedSchemaTypes, "TestSchemaType");
            Assert.Equal("Test", userSettings.GeneratedFileNamePrefix);
            Assert.True(userSettings.GenerateMultipleFiles);
            Assert.True(userSettings.IgnoreUnexpectedElementsAndAttributes);
            Assert.True(userSettings.IncludeCustomHeaders);
            Assert.True(userSettings.IncludeT4File);
            Assert.True(userSettings.IncludeWebProxy);
            Assert.True(userSettings.IncludeWebProxyNetworkCredentials);
            Assert.True(userSettings.MakeTypesInternal);
            Assert.Equal("Test", userSettings.NamespacePrefix);
            Assert.True(userSettings.OpenGeneratedFilesInIDE);
            Assert.Equal("Test", userSettings.ServiceName);
            Assert.True(userSettings.UseDataServiceCollection);
            Assert.True(userSettings.UseNamespacePrefix);
            Assert.Equal("Test", userSettings.WebProxyHost);
            Assert.Equal("Test", userSettings.WebProxyNetworkCredentialsDomain);
            Assert.Equal("Test", userSettings.WebProxyNetworkCredentialsPassword);
            Assert.Equal("Test", userSettings.WebProxyNetworkCredentialsUsername);
        }
コード例 #2
0
        private void LoadUserSettingsFromServiceConfig()
        {
            if (ServiceConfig == null)
            {
                return;
            }

            UserSettings.CopyPropertiesFrom(ServiceConfig);
        }