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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:52:49+00:00 2026-05-12T05:52:49+00:00

I created a custom RoleProvider in a custom library. I would like to unit

  • 0

I created a custom RoleProvider in a custom library. I would like to unit test it. Via Moq I created a fake HttpContextBase. How to pass this to the to be tested RoleProvider?

The Identity is a custom test implementation class. This works fine. I only don’t know how to pass in the fake context in my provider. This is not an MVC application but standard Webforms if that’s information needed.

Grz, Kris.

  • 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-12T05:52:49+00:00Added an answer on May 12, 2026 at 5:52 am

    You could use Dependency Injection (DI) and pass it through your custom RoleProvider’s constructor.

    public MyRoleProvider(HttpContextBase httpContext)
    {
        // ...
    }
    

    This would allow you to pass the Moq instance via the constructor.

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

Sidebar

Related Questions

I created a custom RoleProvider (standard webforms, no mvc) and I would like to
I created custom adapter like this public class SettingsAdapter extends BaseAdapter{ ArrayList<String> Noptions =
I have a custom MembershipProvider and a custom RoleProvider. I created the custom MembershipProvider
i created a custom menu called top-navigation. Now I'd like to style it with
I created custom django-admin commands But, I don't know how to test it in
I have created custom listview, each row looks like my file custom_row.xml. Is there
I have created Custom .NET controls, and I'd like to know if it's possible,
I've created custom dialog (from xml file), like below: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical
When I create a custom role provider by inheriting from RoleProvider, I created a
I created custom django-admin command. I use this tutorial Writing custom django-admin commands For

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.