-1

Folks

How to Exposte RhinoMock Objects as properties

I am trying following code snippet

   internal class Mocks
    {
        private MockRepository.GenerateMock<IFormsAuthentication> formsAuthentication;
    }

but its now working for me anyone know How to do this with rhinomocks

Snehal
  • 329
  • 3
  • 14

1 Answers1

2
MockRepository.GenerateMock<IFormsAuthentication>()

is a method, not a Type.

It looks like what you're looking to do is this:

internal class Mocks    
{
    private IFormsAuthentication formsAuthentication;    

    internal Mocks()
    {
        formsAuthentication = MockRepository.GenerateMock<IFormsAuthentication>();
    }
}
Joseph
  • 25,330
  • 8
  • 76
  • 125
  • Thank buddy this is was I was looking for but now i am running into different Issue internal class Mocks { private static IFormsAuthentication _formsAuthentication; public IFormsAuthentication FormsAuthentication { get { _formsAuthentication = MockRepository.GenerateMock(); return _formsAuthentication; } } – Snehal Oct 13 '10 at 21:48
  • What problem are you having exactly? You might want to edit your question instead of commenting here, it will have a better format. – Joseph Oct 13 '10 at 23:53