コード例 #1
0
        public static void AddConsumers(List <Consumer> consumers, string projectBaseName, string solutionDirectory, string srcDirectory, string testDirectory, IFileSystem fileSystem)
        {
            var validator = new ConsumerValidator();

            foreach (var consumer in consumers)
            {
                var results = validator.Validate(consumer);
                if (!results.IsValid)
                {
                    throw new DataValidationErrorException(results.Errors);
                }
            }

            consumers.ForEach(consumer =>
            {
                ConsumerBuilder.CreateConsumerFeature(solutionDirectory, srcDirectory, consumer, projectBaseName);
                ConsumerRegistrationBuilder.CreateConsumerRegistration(srcDirectory, consumer, projectBaseName);
                MassTransitModifier.AddConsumerRegistation(srcDirectory, consumer.EndpointRegistrationMethodName, projectBaseName);

                IntegrationTestFixtureModifier.AddMTConsumer(testDirectory, consumer.ConsumerName, consumer.DomainDirectory, projectBaseName, srcDirectory);
                ConsumerTestBuilder.CreateTests(solutionDirectory, testDirectory, srcDirectory, consumer, projectBaseName, fileSystem);
            });
        }