mbrit / MoqRT

Implementation of Moq for WinRT. *** Experimental - alpha/proof-of-concept stage ***
17 stars 5 forks source link

Unable to force Baking when Mock<T> is not being used within the code #1

Open rajgit31 opened 12 years ago

rajgit31 commented 12 years ago

Hi Mathew Awesome work on MoqRT. I was trying to find a way to fake dependencies in metro apps and came across with your solution. I got it is working and it is great.

I noticed that if I don't have Mock being used within the code, in the Unit Test library , and when I click on "force " in the Console App (MoqRT.Baker.Client.exe), I get a null ref error...

Starting baking process... Initializing... Unhandled baking exception: --> System.NullReferenceException: Object reference not set to an instance of an object.

Server stack trace: at MoqRT.Baking.BakingWorkItem.Run(BakingContext context) in c:\Git\Repositories\MoqRT\MoqRT.Baker\Controller\BakingWorkItem.cs:line 34 at MoqRT.Baking.BakingPoke.RunWorkItem(BakingController owner, WorkItem item) in c:\Git\Repositories\MoqRT\MoqRT.Baker\Controller\BakingPoke.cs:line 36 at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at MoqRT.Baking.IBakingPoke.RunWorkItem(BakingController owner, WorkItem item) at MoqRT.Baking.BakingRunner.ThreadEntryPoint() in c:\Git\Repositories\MoqRT\MoqRT.Baker\Controller\BakingRunner.cs:line 55

Once I use Mock within the Unit Test code, and attempt to bake, it succeeds.

Scanning test assembly 'MyUnitTestLib.dll'... Found test class 'MyUnitTestLib.UnitTest1'... Found test method 'TestMethod1'... Finished scanning test assembly. Starting baking process... Initializing... Running 'TestMethod1'... ...No failure Finishing up... Baking process complete.

Regards,

Raj

mbrit commented 12 years ago

Can you send me sample code?

On 21 Jun 2012, at 02:54, joelgit31 wrote:

Hi Mathew Awesome work on MoqRT. I was trying to find a way to fake dependencies in metro apps and came across with your solution. I got it is working and it is great.

I noticed that if I don't have Mock being used within the code, in the Unit Test library , and when I click on "force " in the Console App (MoqRT.Baker.Client.exe), I get a null ref error...

Starting baking process... Initializing... Unhandled baking exception: --> System.NullReferenceException: Object reference not set to an instance of an object.

Server stack trace: at MoqRT.Baking.BakingWorkItem.Run(BakingContext context) in c:\Git\Repositories\MoqRT\MoqRT.Baker\Controller\BakingWorkItem.cs:line 34 at MoqRT.Baking.BakingPoke.RunWorkItem(BakingController owner, WorkItem item) in c:\Git\Repositories\MoqRT\MoqRT.Baker\Controller\BakingPoke.cs:line 36 at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at MoqRT.Baking.IBakingPoke.RunWorkItem(BakingController owner, WorkItem item) at MoqRT.Baking.BakingRunner.ThreadEntryPoint() in c:\Git\Repositories\MoqRT\MoqRT.Baker\Controller\BakingRunner.cs:line 55

Once I use Mock within the Unit Test code, and attempt to bake, it succeeds.

Scanning test assembly 'MyUnitTestLib.dll'... Found test class 'MyUnitTestLib.UnitTest1'... Found test method 'TestMethod1'... Finished scanning test assembly. Starting baking process... Initializing... Running 'TestMethod1'... ...No failure Finishing up... Baking process complete.

Regards,

Raj


Reply to this email directly or view it on GitHub: https://github.com/mbrit/MoqRT/issues/1

rajgit31 commented 12 years ago

Looks like the email bounced back. Sample code -> http://sdrv.ms/NXzOD1