I have a system.resx resources file that is used in a SubmitClick method
Protected Sub SubmitClick(ByVal sender As Object, ByVal e As EventArgs)
(...)
If (... AndAlso ...) Then
SetError(Resources.system.groupNoAdminTran)
End If
End Sub
My problem is that no matter how I try to unit test this, the test will fail when the SetError is hit with a:
"Could not load file or assembly 'App_GlobalResources' or one of its
dependencies. The system cannot find the file specified."
Is there any way I can mock the Resources.system?
Thanks
This solution may not be elegant but is the one that I used in the end, feel free to criticise.
Manually created a property for each needed string in the Resources:
Which can then be used like:
As for the test, a simple mock will do:
and that’s all. I hope this helps.