Exception Thrown when Mocking Entities

5 posts, 0 answers
  1. Joel
    Joel avatar
    19 posts
    Member since:
    Dec 2011

    Posted 20 Dec 2011 Link to this post

    I'm using MS Test, VS.NET 2010, I have JustMock Enabled and I'm mocking an ADO.NET SQL Entity.

    Following the directions here:  http://www.telerik.com/help/justmock/basic-usage-entity-framework-mocking.html


    [TestMethod]
    public void EntityTest()
    {
        // Arrange
        var siteFeatures = new List<SiteFeature>();
     
        var entities = Mock.Create<MyEntities>();
     
        Mock.Arrange(() => entities.SiteFeatures)
            .ReturnsCollection(siteFeatures)
            .MustBeCalled();
     
        // Act
        var exists = entities.SiteFeatures.FirstOrDefault(s => s.SiteId == 123) != null;
     
        // Assert
        Assert.IsFalse(exists);
    }


    I'm getting this error:

    Test method EntityTest threw exception: 
    System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)


    Am I doing something wrong?  Is this an issue with MS Test?
  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 23 Dec 2011 Link to this post

    Hi Joel,

    Sorry for the late reply. Please check the following test with our new internal build released yesterday and let me know if you still having the problem. In that regard, please also send me your sample project so that I can investigate further.

    Kind Regards,
    Mehfuz
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft R3 2016 release webinar banner
  4. Joel
    Joel avatar
    19 posts
    Member since:
    Dec 2011

    Posted 28 Dec 2011 Link to this post

    Ok, I created a test project.  I'm getting the same error.

    http://dl.dropbox.com/u/1006254/JustMockTestProject1.zip
  5. Joel
    Joel avatar
    19 posts
    Member since:
    Dec 2011

    Posted 28 Dec 2011 Link to this post

    I have confirmed this problem still exists using the latest internal build.

    quick question.  is there an easy way to update?  I ended up uninstalling and reinstalling to get the latest version.
  6. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 30 Dec 2011 Link to this post

    Hi Joel,

    Thanks again for reporting the issue. I am able to reproduce the exception. Therefore, creating an PITS task and will keep you updated on any fix regarding it.

    You can further track the task here:
    http://www.telerik.com/support/pits.aspx#/public/justmock/9095

    Kind Regards,
    Mehfuz
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft R3 2016 release webinar banner