private static ServiceContractGenerator GetServiceContractGenerator(ICodeGeneratorContext codeGeneratorContext) { Mock <IServiceContractGenerationOptionsBuilder> generationOptionsBuilder = new Mock <IServiceContractGenerationOptionsBuilder>(); IServiceContractGeneratorFactory factory = new ServiceContractGeneratorFactory(generationOptionsBuilder.Object); return(factory.GetServiceContractGenerator(codeGeneratorContext)); }
public void Build_Options_CreatedByOptionsBuilder() { ICodeGeneratorContext codeGeneratorContext = new CodeGeneratorContext(metadataSet, new CodeGeneratorOptions()); const ServiceContractGenerationOptions serviceContractGenerationOptions = new ServiceContractGenerationOptions(); Mock <IServiceContractGenerationOptionsBuilder> generationOptionsBuilder = new Mock <IServiceContractGenerationOptionsBuilder>(); generationOptionsBuilder.Setup(mock => mock.Build(codeGeneratorContext.CodeGeneratorOptions)).Returns(serviceContractGenerationOptions); IServiceContractGeneratorFactory factory = new ServiceContractGeneratorFactory(generationOptionsBuilder.Object); ServiceContractGenerator contractGenerator = factory.GetServiceContractGenerator(codeGeneratorContext); Assert.That(contractGenerator.Options, Is.EqualTo(serviceContractGenerationOptions)); generationOptionsBuilder.Verify(); }