or
							
public class BackgroundThread  {   private Widget _widget;   public BackgroundThread(Widget widget)   {     _widget = widget;   }     public void Run()   {     Console.WriteLine("widget="+_widget);     _widget.DoSomething();   } }   public class Widget {   public void DoSomething()   {     throw new Exception("Not ready to do something");   } }   // Test Class [TestMethod] public void TestBackgroundThread() {   var widget = Mock.Create<Widget>();   var bt = new BackgroundThread(widget);   var thread = new Thread(bt.Run);   thread.Start();   Console.WriteLine("Thread started");   thread.Join();  // Exception is thrown but should not because object was mocked }public class Test1{    protected void Testing1()    {        string s = "Testing1";        throw new Exception("shouldn't be here");    }}public class Test2 : Test1{    protected void Testing2()    {        Testing1();        string s = "Testing2";        throw new Exception("shouldn't be here");    }}public class Test3 : Test2{    protected void Testing3()    {        Testing1();        Testing2();        string s = "Testing3";    }}    [Test]    public void MakeSureAllMethodsAreMockedOut()    {        Test3 test3 = Mock.Create<Test3>();        Mock.NonPublic.Arrange(test3, "Testing3").CallOriginal().MustBeCalled();        test3.GetType().GetMethod("Testing3", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public).Invoke(test3, new object[] { });    }public class Test3 {    protected void Testing1()    {        string s = "Testing1";        throw new Exception("shouldn't be here");    }    public void Testing3()    {        Testing1();        string s = "Testing3";    }}public static IRule MakeMockRule(string description, string rulename, string propname, RuleSeverity severity, bool isbroke)    {        IRule mockRule = Mock.Create<IRule>();        Mock.Arrange(() => mockRule.PropertyName).Returns(propname);        Mock.Arrange(() => mockRule.RuleName).Returns(rulename);        Mock.Arrange(() => mockRule.Severity).Returns(severity);        Mock.Arrange(() => mockRule.IsBroken).Returns(isbroke);        Mock.Arrange(() => mockRule.HandlesProperty(propname)).Returns(true);        Mock.Arrange(() => mockRule.Description).Returns(description);        return mockRule;    }var source = Mock.Create<FooBase>(Constructor.Mocked);private class _commandLineArgument), everything works as expected.  Anybody can explain this behavior?  Anyway to make it work without making it a class.  Thank you.public abstract class ConsoleBase{        private struct _commandLineArgument        {            public string Name { get; set; }            public string Description { get; set; }            public bool IsRequired { get; set; }            public string Value { get; set; }            public bool Found { get; set; }        }}Type argType = Type.GetType( "Utilities.ConsoleBase+_commandLineArgument" );Mock.NonPublic.Arrange<bool>( argType, "Found" ).Returns(true);using (var siteCollection = new SPSite(spWebAppUri + siteUrl)) { // more code... }// the next time a new instance of SPSite is created, use our fake one instead   Isolate.Swap.NextInstance<SPSite>().With(fakeSite);IRTObjectModel model = Mock.Create<IRTObjectModel>(); Mock.Arrange<TimeSpan>(() => model.ShiftDateStartTime) .Returns(shiftDateStartTime); Mock.Arrange<IDictionary<string, FuelBay>>(() => model.FuelBays) .Returns(initialTestData.ActiveFuelBays); Mock.Arrange<IDictionary<string, FuelTruck>>(() => model.FuelTrucks) .Returns(initialTestData.ActiveFuelTrucks);
using System.Diagnostics;        [ClassInitialize()]        public static void MyClassInitialize(            TestContext testContext)        {            Mock.Initialize(typeof(Debug));            Mock.Partial(typeof(Debug)).For<bool, string>((i, j) => Debug.Assert(i, j));        }        public void Test()        {            Mock.Arrange(() => Debug.Assert(Arg.AnyBool, Arg.AnyString)).DoNothing();            DoSomeFunctionThatAsserts();        }