private void ContractGeneratorCommonAsserts(ContractGenerator generator, ContractGenerationOptions options)
        {
            // Assert proxy class
            string proxyClass = GetClassFromCcu(options.CodeProvider, generator.CodeCompileUnit);
            Assert.IsNotNull(proxyClass);
            Assert.IsTrue(proxyClass.Contains("IMockServiceContract"));

            // Assert config file
            ServiceModelConfigurationManager manager = new ServiceModelConfigurationManager(generator.Configuration);
            ClientSection client = manager.GetClient();

            Assert.AreEqual(1, client.Endpoints.Count);
            ChannelEndpointElement createdEndpoint = client.Endpoints[0];
            Assert.AreEqual(Constants.Uris.TestContractGenerationEndpointAddress, createdEndpoint.Address.AbsoluteUri);
            Assert.AreEqual(Constants.ServiceDescription.WsHttpHostClientName, createdEndpoint.Name);
            Assert.AreEqual(Constants.ServiceDescription.WsHttpHostClientBinding, createdEndpoint.Binding);
        }
 private Collection<IWsdlImportExtension> LoadWsdlImportExtensions()
 {
     if (this.configuration != null)
     {
         ServiceModelConfigurationManager manager = new ServiceModelConfigurationManager(this.configuration);
         ClientSection client = manager.GetClient();
         if (client != null)
         {
             return client.Metadata.LoadWsdlImportExtensions();
         }
     }
     return null;
 }
		public void ShouldMergeConfigContentWithSameEndpoint()
		{
			ContractGenerationOptions options = new ContractGenerationOptions();
			options.OutputConfigurationFile = ConfigurationLoader.GetConfigurationFilePath(@"SampleData\Empty.config", "ShouldMergeConfigContentWithSameEndpoint", true);

			string originalConfig = File.ReadAllText(options.OutputConfigurationFile);
			ContractGenerator generator = new ContractGenerator(options);
			MetadataSet metadata = GetMetadataSet(HostAddress);
			WsdlImporter importer = generator.CreateWsdlImporter(metadata);
			generator.Generate(importer);
			// generate twice in order to update and get only one endpoint in config
			generator.Generate(importer);

			Assert.AreNotEqual(originalConfig, File.ReadAllText(options.OutputConfigurationFile));

			// Assert config file
			ServiceModelConfigurationManager manager = new ServiceModelConfigurationManager(generator.Configuration);
			ClientSection client = manager.GetClient();
			Assert.AreEqual<int>(2, client.Endpoints.Count);
		}