Pending Review
Last Updated: 21 Sep 2020 10:01 by Ivo
The issue is reproducible inside Visual Studio 2017, the same tests are running normaly outside the IDE or using 2019.
Pending Review
Last Updated: 19 Apr 2017 08:19 by Maxim
Created by: Maxim
Comments: 0
Type: Bug Report
I have logging class which are using everywhere.
I want to Mock this class for all tests. And i tried to use AssemblyInitialize but got problem. I have simulated this problem with JustMock.ElevatedExamples.AdvancedUsage examples:
1) Add BaseTest class
    public class BaseTest
        public static void AssemblyInit(TestContext context)
            Mock.SetupStatic(typeof(Common1), StaticConstructor.Mocked);
            // Arranging: When the static(Foo.FooProp_GET) property is called, it should return expected.
            var fakeUsed = Mock.Create<LogWriter1>(Constructor.Mocked);
            Mock.Arrange(() => Common1.Log).Returns(fakeUsed);

        public static void Cleanup()
            //clean up stuff here
    public static class Common1
        static Common1()

            Log = new LogWriter1();


        public static LogWriter1 Log { get; set; }


    public class LogWriter1


2) When run test from VS - all ok
3) When run from command line it is not working. Show Message box "Process Starts Now".

SET COR_PROFILER={B7ABE522-A68F-44F2-925B-81E7488E9EC0}
"C:\Program Files (x86)\Telerik\JustMock\Libraries\JustMockRunner.exe" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:"D:\test\CSExamples\JustMock.ElevatedExamples\bin\Debug\JustMock.ElevatedExamples.dll"

How i can mock logger for all test? It is static public property.

I use MS Test + VS 2015.