public override void Check(char currentCharacter, Context context)
 {
     context.DoSetup(currentCharacter);
     base.Check(currentCharacter, context);
     context.DoTeardown(currentCharacter);
 }
 protected void SetUp()
 {
     ruleChecker = new WidthRule();
     results = new Results(TEST_FILENAME);
     context = new Context();
 }
 protected void TearDown()
 {
     ruleChecker = null;
     results = null;
     context = null;
 }
 protected void SetUp()
 {
     context = new Context();
     lineChecker = new TestCheckerMockLine();
 }
 protected void TearDown()
 {
     context = null;
     lineChecker = null;
 }
 protected abstract void DoNewLine(Context context);
 public virtual void Check(char currentCharacter, Context context)
 {
     this.myContext = context;
     myChain.Execute(currentCharacter);
 }
 protected override void DoNewLine(Context context)
 {
     HandleNewWord(Constants.ASCII_LF);
 }
 protected override void DoNewLine(Context context)
 {
     if (maxCharacters < charactersInLine) {
         LineTooWide(context);
     }
     charactersInLine = 0;
     lineStart = true;
 }
 protected override void DoNewLine(Context context)
 {
     if (delayViolation != null) {
         if (!context.IsInitializingTheBaseClass(firstCharacterInLine)) {
             context.AddViolation(delayViolation);
         }
         delayViolation = null;
     }
     if ((ParensLevel > 0 || !tailChars.Contains(context.LastCharacter))) {
         delayViolation = OneLinePerStatement();
         if (')' != context.LastCharacter) {
             if (!(']' == context.LastCharacter && isInAttribute)) {
                 context.AddViolation(delayViolation);
             }
             delayViolation = null;
         }
     }
     firstCharacterInLine = Constants.ASCII_CR;
 }
 protected override void DoNewLine(Context context)
 {
     int resultCommas = commas - (context.LastCharacter == ',' ? 1 : 0);
     if (resultCommas > 0 || semiColumns > 1) {
         context.AddViolation(OneStatementPerLine());
     }
     semiColumns = 0;
     commas = 0;
     isInterfaceDef = false;
 }
 protected override void DoNewLine(Context context)
 {
     if (inMethod) {
         bool countIt = (context.TotallyEmptyLine || (iHaveCode && !context.IAmInComment));
         if (countIt) {
             myMethodLength++;
         }
     } else {
         if (context.LastCharacter == '{' && methodEnter && methodExit && ParensLevel == 0) {
             inMethod = true;
             myMethodReentranceStart = myReentrance;
             originalMethodLine = Context.CurrentLine;
         }
     }
     methodEnter = false;
     methodExit = false;
     iHaveCode = false;
 }
 protected override void DoNewLine(Context context)
 {
     bool countIt = context.TotallyEmptyLine || iHaveCode;
     if (countIt) {
         myCodeLenght++;
     }
     iHaveCode = false;
 }
 public override void Close(Context context)
 {
     if (Constants.ALLOWABLE_LINES_PER_FILE < myCodeLenght) {
         context.AddViolation(CompilationUnitTooLong());
     }
 }
 public override void Close(Context context)
 {
     base.Close(context);
 }
 private void LineTooWide(Context context)
 {
     string viewLine = context.CurrentLine.Replace(' ', '.');
     string message = "This line is too wide: {0} instead of {1}";
     message = string.Format(CultureInfo.InvariantCulture, message, charactersInLine, maxCharacters);
     context.AddViolation(new Violation(ViolationType.LineTooWide, message, context.FileLenght, viewLine));
 }
 private void InitializeRuleset()
 {
     context = new Context();
 }
 public virtual void Close(Context context)
 {
     DoNewLine(context);
 }