This is a migrated thread and some comments may be shown as answers.

Exception Thrown when Mocking Entities

4 Answers 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Joel asked on 21 Dec 2011, 03:35 AM
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?

4 Answers, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 23 Dec 2011, 07:10 PM
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 >>

0
Joel
Top achievements
Rank 1
answered on 29 Dec 2011, 02:58 AM
Ok, I created a test project.  I'm getting the same error.

http://dl.dropbox.com/u/1006254/JustMockTestProject1.zip
0
Joel
Top achievements
Rank 1
answered on 29 Dec 2011, 03:52 AM
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.
0
Ricky
Telerik team
answered on 30 Dec 2011, 09:05 PM
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 >>

Tags
General Discussions
Asked by
Joel
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Joel
Top achievements
Rank 1
Share this question
or