Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rajgit31 opened this issue Jun 21, 2012 · 2 comments
Open

Comments

@rajgit31
Copy link

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
Copy link
Owner

mbrit commented Jun 21, 2012

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:
#1

@rajgit31
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants