Testing project with App_Globalresources

0

I need to create tests for project that using App_GlobalResources with *.resx files. Some methods of this project using values from *.resx files, for example from Captions.resx:

result = String.Format("{0} \"{1}\"", Captions.Ownership, ownership.TitlingName);

So when i testing this method from another test project im getting error:

'Could not load file or assembly 'App_GlobalResources' or one of its dependencies. The system cannot find the file specified.'

From FusionLog of exception i can see that test project trying to load dll from his Debug folder.

Another problem that my resources Build Action is set to Content so they doesnt compiling into .dll. So i copy App_GlobalResources from temp VS folder into test project debug folder, but after that when file was founded im get another error: :

'Could not load file or assembly 'App_GlobalResources' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

FusionLog:

LOG: Attempting download of new URL file:///C:/f/Projects/lexserv/lexserv/MlfLexservUnitTests/bin/Debug/App_GlobalResources.DLL.
WRN: Comparing the assembly name resulted in the mismatch: NAME
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Its probably because dll version, but when i change dll version by Resource tuner e.g. im still getting same error. I know that there is the way to change .resx files access modifier to public, but this is not my solution. So question is how should i import App_GlobalSource.dll to test project to test methods wich calls .resx files?

c#
unit-testing
dll
app-globalresources
asked on Stack Overflow Jun 13, 2018 by dennismeister

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0