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

  • Home
  • SEARCH
  • 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 8376007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:19:16+00:00 2026-06-09T15:19:16+00:00

So I was putting together some simple unit tests for a console application I

  • 0

So I was putting together some simple unit tests for a console application I was writing. When I was putting the final touches on a test, I came across a strange access issue.

Assert.Equals(testRegex.Evaluate(testString),true);

This threw a error saying the Evaluate method was inaccessible due to its protection level. It is public in the base class. Here is the base class and sub class.

abstract class RegexEvaluator
{
    //Fields
    protected string Regex { get; set; }

    public bool Evaluate(string text)
    {
        if (System.Text.RegularExpressions.Regex.IsMatch(text, Regex))
            return true;
        else
            return false;
    }
}

public class SSNRegex : RegexEvaluator
{
    public SSNRegex()
    {
        //Stubbed for now, don't worry about the regex
        this.Regex = "\\d{3}-\\d{2}-\\d{4}";
    }
}

I was able to solve the issue by adding to the SSNRegex

public bool Evaluate(string text)
{
    return base.Evaluate(text);
}

My question is I’m confused about why I wasn’t able to access the base class method. Why?

  • 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-09T15:19:18+00:00Added an answer on June 9, 2026 at 3:19 pm

    You must sign RegexEvaluator as public. It’s internal by default, that’s why you can’t access it from another assembly (such as the unit test).

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

Sidebar

Related Questions

I'm putting together some virtual machines to test different browsers and I'm wondering if
I am attempting to teach myself some JQuery/REST/Google API by putting together a simple
While putting together a Boggle solver, I ran into some strange behavior I was
I need some help putting together this query in Django. I've simplified the example
I'm putting together a quick script to scrape a page for some results and
I'm just putting together a little POC project, and I'm having some weird issues
I am putting together a fairly simple web app that uses user inputted data
I'm putting together some demo pages, and one of the things I want to
I'm putting together some code to essentially replace the contents of a div when
I'm putting together a simple web page that presents the user with a jQuery

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.