urasandesu / Prig

Prig is a lightweight framework for test indirections in .NET Framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

texavery77 opened this issue · comments

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?

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