Microsoft.Fakes won't run in normal unit test contexts
问题 I'm using a simple proof-of-concept Fakes nUnit test: [Test] public void TestFakes() { using (var ctx = ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => { return new DateTime(2000, 1, 1); }; Assert.That(DateTime.Now.Year, Is.EqualTo(2000)); } } This test runs in the Visual Studio Test Explorer, but doesn't run in: nUnit GUI nUnit console The JetBrains test runner (dotCover OR Resharper) TestDriven.net test runner In each of these, I receive the following error: Microsoft