After banging my head with monitor for some time, it finally started to work. Here is what I did:
You need to clean the test project and then build it again
Hope this helps to some one suffering from the same problem.
As for the approach is considered I am using the below code:
namespace A.Tests
{
class BTest
{
void Method1Test(){
bool isMethodInvoked=false;
A.BusinessLayer.Moles.MAManager.AllInstances=()=>{
isMethodInvoked=true;
};
B=new B();
B.Method1();
Assert.IsTrue(isMethodInvoked, "Method is not invoked");
}
}
}