0

I am following MSDocs guide to put up some unit testing. I've never used them before and I've never been using them because to me they are totally useless, but I see it's a common practice, so I wanted to learn more.

Obviously, this is not working.

I've put up some .NET Standard 2.0 libraries with little to no code to do some log4net logging. I've addet a "Unit test project" as the guide suggests and added a method decorated with the "TestMethod" attribute and all the other attributes.

Test explorer windows does not show any test and I'm not able to even run them in any way. What am I missing?

Here's the code

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MrLogger_netstandard;

namespace UnitTests
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void ErrorLogOnFile_Default() => MrLogger.Instance.FileErrorLog("I'M AN ERROR!!! :)");
    }
}

The MrLogger class it's just a class that does logger.Debug("Write message"), a classical log4net logging call.

I've tried this too and it changes nothing.

Jeez... help

Liquid Core
  • 1
  • 6
  • 27
  • 52
  • Try creating a new default test project. File->New->Project ->Visual C#-> Test. It should create one empty test. then Test->Run->All tests, and see if it runs 1 test – Gonen I Jan 15 '18 at 09:29
  • Tried to do that, rebuild solution as visual studio suggests and change even test architecture again, but no test is discovered. Test->Run->All tests is greyed out because there is no test available. I've tried to create Visual C# and NET Core unit tests but no luck. – Liquid Core Jan 15 '18 at 09:40
  • I had a similar problem once. Perhaps the vs execution process is dead or hung. Take a look at some of the solutions here : https://stackoverflow.com/questions/17664886/error-debugging-code-in-visual-studio-2012-failed-to-initialize-client-proxy/ – Gonen I Jan 15 '18 at 09:54
  • @user889742 That post led me to the solution. It was administrator rights.... UGH.... that's dumb – Liquid Core Jan 15 '18 at 12:03

1 Answers1

2

For anyone wondering, I had to start visual studio as administrator and then it worked.... UGH! :(

Liquid Core
  • 1
  • 6
  • 27
  • 52