Last post Apr 01, 2017 05:09 PM by shahzad73
Apr 01, 2017 10:51 AM|shahzad73|LINK
I added reference of my web application project in a separate project in the same solution. I wrote test cases for the database service objects in test project. when i execute all, all test cases fails with a single error
Note my test environment is Visual Studio 2015 - and project is Core ASP.NET framework project
Test Name: CheckAllExpectedStocksReturned
Test FullName: UnitTest.StocksTests.CheckAllExpectedStocksReturned
Test Source: E:\Projects\VSProject\StockExchangeAssignment\StocksApp\UnitTest\StocksTests.cs : line 74
Test Outcome: Failed
Test Duration: 0:00:00
Result StackTrace: at UnitTest.StocksTests.InitializeStocksTests(TestContext context)
Result Message: Class Initialization method UnitTest.StocksTests.InitializeStocksTests threw exception. System.BadImageFormatException: System.BadImageFormatException: Could not load file or assembly 'StocksApp, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. An attempt was made to load a program with an incorrect format..
My reading the web i found that there is mismatch of processor architecture in both project. So by using Build->Configuration Manager. Test project platform is x86 and Web project platform is Any CPU. i tied to set the web project platform to x86 but
every time i open configuration i see the same Any CPU.
Then i set the platform in project.json for the web application still all test cases fail
Apr 01, 2017 01:33 PM|raju dasa|LINK
check this site for same issue, comments and fixes:
Apr 01, 2017 02:50 PM|markfitzme|LINK
Is the test project running through IIS? Then make sure the application pool has Enable 32-bit Applications set to true.
Apr 01, 2017 05:09 PM|shahzad73|LINK
No i am running test cases from within VS2015.