Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColoredConsoleTarget: Fixed broken WholeWords option of highlight-word. #996

Merged
merged 1 commit into from
Oct 24, 2015

Conversation

bhaeussermann
Copy link
Contributor

No description provided.

@bhaeussermann
Copy link
Contributor Author

In the new ColoredConsoleTargetTests class, I wanted to additionally test for the foreground color (value of Console.ForegroundColor when the Write() method is called), but it seems when running Xunit tests, then setting the ForegroundColor property has no effect. The property's value always stays Gray.

I suspect this is because there is no console. See the following code from the ForegroundColor setter in Console.cs:

bool succeeded; 
Win32Native.CONSOLE_SCREEN_BUFFER_INFO csbi = GetBufferInfo(false, out succeeded); 
// For code that may be used from Windows app w/ no console
if (!succeeded) 
    return;

I couldn't find a way around this, but at least we can "see" where the color is supposed to change, which the tests do exploit.

@codecov-io
Copy link

Current coverage is 71.54%

Merging #996 into master will increase coverage by +0.85% as of 4337587

@@            master    #996   diff @@
======================================
  Files          262     262       
  Stmts        14793   14793       
  Branches      1614    1611     -3
  Methods          0       0       
======================================
+ Hit          10458   10584   +126
- Partial        399     417    +18
+ Missed        3936    3792   -144

Review entire Coverage Diff as of 4337587


Uncovered Suggestions

  1. +0.08% via ...c/NLog/LogFactory.cs#180...191
  2. +0.08% via ...anceCounterTarget.cs#308...318
  3. +0.08% via ...anceCounterTarget.cs#294...304
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@304NotModified
Copy link
Member

Yeah! Just in time :)

@304NotModified 304NotModified added this to the 4.2 milestone Oct 24, 2015
@304NotModified 304NotModified added the bug Bug report / Bug fix label Oct 24, 2015
304NotModified added a commit that referenced this pull request Oct 24, 2015
ColoredConsoleTarget: Fixed broken WholeWords option of highlight-word.
@304NotModified 304NotModified merged commit 56a15f1 into NLog:master Oct 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report / Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants