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 7949257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:56:42+00:00 2026-06-04T01:56:42+00:00

I have looked into google and stack over flow and read all the posts

  • 0

I have looked into google and stack over flow and read all the posts regarding how to get InternalsVisibleTo to work.

But its not working for me.

Please do not down vote this question because I have tried my best to look and implement the answers on the forums..

My code is as follows:

* Inside TestInternal project *

namespace TestInteral
{
    [TestClass]
    public class MyProviderTest
    {
        [TestMethod]
        public void TestBar()
        {
            bool retval = false;

            retval = new MyProviderClass().Bar();

            Assert.AreEqual(true,retval);
        }

    }
}

* Inside Provider Project *

[assembly: InternalsVisibleTo("TestInternal")]
namespace Provider
{

    public class MyProviderClass
    {
        internal bool Bar()
        {
            return true;

        }

        private void UseBar()
        {
            bool retval = Bar();

        }
    }
}

I am getting the following error in my test class.

Error 1 ‘Provider.MyProviderClass’ does not contain a definition for ‘Bar’ and no extension method ‘Bar’ accepting a first argument of type ‘Provider.MyProviderClass’ could be found (are you missing a using directive or an assembly reference?)

Please let me know how I could use the InternalsVisibleTo correctly so I could correctly test the Internal method in the MyProviderClass.

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-06-04T01:56:44+00:00Added an answer on June 4, 2026 at 1:56 am

    Assuming you have just copied and pasted your EXACT code into the question, this is a simple typo. I noticed your namespace on the test assembly is TestInteral with no ‘N’. And your InternalsVisibleTo declaration has the last ‘N’:

    [assembly: InternalsVisibleTo("TestInternal")]
    

    That’s probably all it is.

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

Sidebar

Related Questions

I just have been looked into Google's source code and I saw that the
Ok I have looked into this, and I'm not sure if anyone else has
I have a modeling question related to profiles. Firstly, I have looked into using
I've looked into the API Demos and they have an example of the gallery
Have looked quite hard for this answer but having no luck. I have 3
I have looked and tried but don't see where I can stop some being
I have looked at the usual suspects...Spark, NHaml, etc. They all seem to be
I have recently looked into this and discovered that using FBML pages in a
I have looked a lot on google for answers of how to use the
I've looked around (here at stackoverflow and with Google) but I can't seem to

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.