urasandesu / Prig

Prig is a lightweight framework for test indirections in .NET Framework.
Other
117 stars 21 forks source link

Mocking not working at all under VS 2015 Professional (Windows 7 Pro SP1) #101

Open texavery77 opened 6 years ago

texavery77 commented 6 years ago

I followed the quickstart instructions exactly, trying to mock DateTime.Now from a simple Console application (based on .NET 4.6.1), but the actual mocking just does not take place, I always get the real date from DateTime.Now without getting any errors (that might give a hint that some critical part is missing).

            {
                PDateTime.NowGet().Body = () => new DateTime();

                var x = DateTime.Now;

                // always outputs real date/time
                System.Console.WriteLine("Time: " + x.ToString("G")); 
                System.Console.ReadLine();
                return;
            }

Am I missing something something important?

JRallee commented 6 years ago

Hi,

I am facing the same issue. The test does not use the mocked values at all :(

Also to add, the Urasandesu.* dlls were not added automatically, I had to search and track it in Program data folder and add it manually. Maybe, something went wrong in installation?

Some help would be really nice. Note: Running MSTest