4

I need to implement my own Profile properties and was going to inherit from System.Web.Profile.ProfileBase to achieve this.

What I don't understand is how to best unit test this Profile class in isolation without hitting the database.

Burt
  • 7,680
  • 18
  • 71
  • 127

1 Answers1

1

I came across this situation today and found your question while trying to find an answer.

What I have ended up doing is wrapping up all calls to ProfileBase in a wrapper class, and mocking out the wrapper class using this pattern which talks specifically about Rhino Mocks

Not sure this will help you as it was a few months ago now since you asked the question.

Community
  • 1
  • 1
ozz
  • 5,098
  • 1
  • 50
  • 73
  • An example would be great. Followed the link provided but they don't give an example either. – shanabus Jan 25 '11 at 21:27
  • @shanabus Create IProfileCommon and copy prorties in your ProfileCommon which will inherit from both ProfileBase, IProfileCommon. Use IProfileCommon as parameters and then when saving it, cast it back to ProfileCommon. – MichaelChan Sep 13 '18 at 01:58