Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6895399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:54:13+00:00 2026-05-27T06:54:13+00:00

I have a system.resx resources file that is used in a SubmitClick method Protected

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:54:14+00:00Added an answer on May 27, 2026 at 6:54 am

    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:

    Public Property GroupNoAdminTran() As String
        Get
            If String.IsNullOrEmpty(_groupNoAdminTran) Then
                _groupNoAdminTran = Resources.system.groupNoAdminTran
            End If
            Return _groupNoAdminTran
        End Get
        Set(ByVal value As String)
            _groupNoAdminTran = value
        End Set
    End Property
    

    Which can then be used like:

    Protected Sub SubmitClick(ByVal sender As Object, ByVal e As EventArgs)
    
      (...)
    
      If (... AndAlso ...) Then
          SetError(GroupNoAdminTran)
      End If
    
    End Sub 
    

    As for the test, a simple mock will do:

    _moqView.Setup(x => x.GroupNoAdminTran).Returns("GroupNoAdminTranTest");
    

    and that’s all. I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within a Visual Basic Project I have added a resource file (resx) that contains
We have system here that uses Java JNI to call a function in a
I have a system that combines the best and worst of Java and PHP.
I have a system that uses a meta refresh to a logout page, which
We have a system where customers, mainly European enter texts (in UTF-8) that has
I have two system calls GetSystemTime() and GetThreadTimes() that I need to calculate the
I have a controls library which I've added a .resx file to (ImageResources.resx). It
I am storing a set of values in a resource file (resx) and have
I have two Resources files under App_GlobalResources MyApp.resx MyApp.sv.resx for those who don't know:
I have system, that using keywords for some data There are normal keywords and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.