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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:16:28+00:00 2026-06-17T18:16:28+00:00

I have the following setup. A solution with 3 Projects. Project A, Namespace A,

  • 0

I have the following setup. A solution with 3 Projects.

Project A, Namespace A, Class A

Project B, Namespace B, Class B : A

and a Test project for unit tests on B. To access private functions of B i create an accessor in my Test project using Create Private Accessor -> Test.

It seems as A is in another assembly VS does not create accessor functions for A.

  • 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-17T18:16:30+00:00Added an answer on June 17, 2026 at 6:16 pm

    You need to use multiple accessors. Consider this:

    // Assembly A
    public class ClassA
    {
        protected int someInt = 1;
        private void DoSthmWithA()
        {
            someInt = 10;
        }
    }
    
    // Assembly B
    public class ClassB : ClassA
    {
        private void DoSthmWithB()
        {
            someInt = 11;
        }
    }
    
    [TestMethod()]
    public void Testing
    {
        var target = new ClassB();
    
        var poA = new PrivateObject(target, new PrivateType(typeof (ClassA)));
        var poB = new PrivateObject(target);
    
        var accA = new ClassA_Accessor(poA);
        var accB = new ClassB_Accessor(poB);
        accA.DoSthmWithA();
        Assert.AreEqual(accA.someInt, 10);
        accB.DoSthmWithB();
        Assert.AreEqual(accA.someInt, 11);
    }
    

    or

    [TestMethod()]
    public void Testing
    {
       var target = new ClassB();
    
       var poA = new PrivateObject(target, new PrivateType(typeof(ClassA)));
       var poB = new PrivateObject(target);
    
       poA.Invoke("DoSthmWithA");
    
       var accA = new ClassA_Accessor(poA);
       Assert.AreEqual(accA.someInt, 10);
    
       poB.Invoke("DoSthmWithB");
    
       Assert.AreEqual(accA.someInt, 11);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC solution setup like this, with three 'projects'. Web (MVC Project,
I have the following project setup: Solution A Project 1 (a lightweight component) Project
When using ASP.net webforms my usual solution would have following type of setup -
I have following models setup in my Django application class School(models.Model): name = models.TextField()
I have the following setup: eclipse a standard Java project (A) an eclipse plugin
We have a VS 2010 solution that includes a few class library projects, a
I have a solution with 10+ projects (VS2010 SP1). I have the following configurations
I have 2 projects in my solution: Assembly (Basic Library) Test Assembly (NUnit) I
I have the following test fixture class and for reasons beyond me NUnit decides
I have a project in ASP.NET MVC 3, the solution file contains 28 projects

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.