Ejemplo n.º 1
0
        public void Setup()
        {
            var exceptionHandler = new TestExceptionHandler();
            var windsorContainer = ContainerFactory.CreateContainer(exceptionHandler);

            _ContainerType = ContainerSettings.ContainerType;
            var calculatorFactory = windsorContainer.Resolve <ICyclomaticComplexityCalculatorFactory>();

            calculator = calculatorFactory.Create();
            var extractorFactory = windsorContainer.Resolve <IMethodsExtractorFactory>();

            extractor = extractorFactory.Create();
        }
Ejemplo n.º 2
0
        public MetricsAdornment(IWpfTextView view, IMethodsExtractor methodsExtractor, ICyclomaticComplexityCalculator cyclomaticComplexityCalculator)
        {
            if (methodsExtractor == null)
            {
                throw new ArgumentNullException(nameof(methodsExtractor));
            }
            if (cyclomaticComplexityCalculator == null)
            {
                throw new ArgumentNullException(nameof(cyclomaticComplexityCalculator));
            }

            this.view = view;
            layer     = view.GetAdornmentLayer(MeticsAdornmentFactory.ADORNMENT_NAME);

            this.view.LayoutChanged          += OnLayoutChanged;
            this.view.TextBuffer.PostChanged += OnTextBufferChanged;

            this.methodsExtractor = methodsExtractor;
            this.cyclomaticComplexityCalculator = cyclomaticComplexityCalculator;

            Init(view.TextSnapshot);
        }