What would be an alternate to [TearDown] and [SetUp] in MSTest?
You would use [TestCleanup] and [TestInitialize] respectively.
You would use [TestCleanup] and [TestInitialize] respectively.
You can use the PrivateObject class: Class target = new Class(); PrivateObject obj = new PrivateObject(target); var retVal = obj.Invoke(“PrivateMethod”); Assert.AreEqual(expectedVal, retVal); Note: PrivateObject and PrivateType are not available for projects targeting netcoreapp2.0 – GitHub Issue 366
I know this is an old thread, but I thought I’d post a vote for xUnit.NET. While most of the other testing frameworks mentioned are all pretty much the same, xUnit.NET has taken a pretty unique, modern, and flexible approach to unit testing. It changes terminology, so you no longer define TestFixtures and Tests…you specify … Read more
Same problem, but i installed EF 6 through Nuget. EntityFramework.SqlServer was missing for another executable. I simply added the nuget package to that project.
For “Visual Studio Team Test” it appears you apply the ExpectedException attribute to the test’s method. Sample from the documentation here: A Unit Testing Walkthrough with Visual Studio Team Test [TestMethod] [ExpectedException(typeof(ArgumentException), “A userId of null was inappropriately allowed.”)] public void NullUserIdInConstructor() { LogonInfo logonInfo = new LogonInfo(null, “P@ss0word”); }