コード例 #1
0
        private static ServiceContractGenerator GetServiceContractGenerator(ICodeGeneratorContext codeGeneratorContext)
        {
            Mock <IServiceContractGenerationOptionsBuilder> generationOptionsBuilder = new Mock <IServiceContractGenerationOptionsBuilder>();
            IServiceContractGeneratorFactory factory = new ServiceContractGeneratorFactory(generationOptionsBuilder.Object);

            return(factory.GetServiceContractGenerator(codeGeneratorContext));
        }
コード例 #2
0
        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();
        }