JustMock + Compact Framework?

4 posts, 0 answers
  1. Joe Parks
    Joe Parks avatar
    4 posts
    Member since:
    Jun 2012

    Posted 21 Feb 2011 Link to this post

    Is it possible to use JustMock for Compact Framework projects in VS 2008? For now, I am using the free edition.
    The following does not compile, where "IService" is just an example interface with a single method, "DoSomething()":

                IService service =  Mock.Create<IService>();
                    
    Mock.Arrange(()=>service.DoSomething()).MustBeCalled();

    The compiler spits out this error:
    Error 2 Cannot convert lambda expression to type 'System.Linq.Expressions.Expression`1<Telerik.JustMock.Action2>' because it is not a delegate type
  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 23 Feb 2011 Link to this post

    Hi Joe,

    Thanks again for raising the question.

    It turns out that compact framework fails to auto convert TDelegate to Expression<TDelegate> format.

    Officially, we don’t have a compact framework build for JustMock. However, the recommended the way is to reference the target compact framework library right from .net 3.5 project and things will work out just nicely. Additionally, you will be able to use TestDriven.Net or similar test runners without much tweaking.

    Finally, I have attached a sample project that shows the similar technique. Please check it out and do write us back for further issues.


    Kind regards,
    Ricky
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft R3 2016 release webinar banner
  4. Joe Parks
    Joe Parks avatar
    4 posts
    Member since:
    Jun 2012

    Posted 23 Feb 2011 Link to this post

    Hrm. The project does compile, but the test does not run on the device. It throws the exception:

    System.MissingMethodException: File or assembly name 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089', or one of its dependencies, was not found..

    It sounds like, for device unit tests, I'll need to stick with Rhino Mocks. It's a shame, because JustMock seems like an overall better library.
  5. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 24 Feb 2011 Link to this post

    Hi Joe,

    Thanks again for the reply.

    Actually, within the .net CF runtime most mocking framework that uses expression and invokes member from Reflection.Emit won’t work (Ex.Moq). Here is one interesting post from StackOverflow on this that describes it nicely.

    http://stackoverflow.com/questions/1004560/rhino-mocks-compact-framework

    Unless you are testing your library within the device itself, the other way is to create a .net 3.5 project  and then reference the compact framework library from there. In that case, you are executing the tests using .net 3.5 runtime therefore won’t face the above issues.

    Hope this information is useful.

    Best wishes,
    Ricky
    the Telerik team

    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top