/// <summary> /// Analyzes the information added so far to this builder and creates a new <see cref="MixinConfiguration"/> from that data. /// </summary> /// <returns>An <see cref="MixinConfiguration"/> derived from the configuration specified in the builder's constructor containing /// <see cref="ClassContext"/> and <see cref="MixinContext"/> objects based on the information added so far.</returns> public MixinConfiguration BuildConfiguration() { s_log.InfoFormat("Building mixin configuration from {0} types.", _allTypes.Count); using (StopwatchScope.CreateScope(s_log, LogLevel.Info, "Time needed to build mixin configuration: {elapsed}.")) { var typeAnalyzers = new IMixinDeclarationAnalyzer <Type>[] { CreateAttributeAnalyzer <Type>(), new HasComposedInterfaceMarkerAnalyzer() }; var assemblyAnalyzers = new IMixinDeclarationAnalyzer <Assembly>[] { CreateAttributeAnalyzer <Assembly> () }; var configurationAnalyzer = new DeclarativeConfigurationAnalyzer(typeAnalyzers, assemblyAnalyzers); var configurationBuilder = new MixinConfigurationBuilder(_parentConfiguration); configurationAnalyzer.Analyze(_allTypes, configurationBuilder); return(configurationBuilder.BuildConfiguration()); } }
public void Analyze() { var types = new[] { typeof(object), typeof(string), typeof(DeclarativeConfigurationAnalyzerTest) }; using (_mockRepository.Ordered()) { _typeAnalyzerMock.Expect(mock => mock.Analyze(typeof(object), _fakeConfigurationBuilder)); _assemblyAnalyzerMock.Expect(mock => mock.Analyze(typeof(object).Assembly, _fakeConfigurationBuilder)); _typeAnalyzerMock.Expect(mock => mock.Analyze(typeof(string), _fakeConfigurationBuilder)); _typeAnalyzerMock.Expect(mock => mock.Analyze(typeof(DeclarativeConfigurationAnalyzerTest), _fakeConfigurationBuilder)); _assemblyAnalyzerMock.Expect(mock => mock.Analyze(typeof(DeclarativeConfigurationAnalyzerTest).Assembly, _fakeConfigurationBuilder)); } _mockRepository.ReplayAll(); var analyzer = new DeclarativeConfigurationAnalyzer(new[] { _typeAnalyzerMock }, new[] { _assemblyAnalyzerMock }); analyzer.Analyze(types, _fakeConfigurationBuilder); _mockRepository.VerifyAll(); }