views:

13

answers:

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

+1  A: 
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
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<IFormsAuthentication>(); return _formsAuthentication; } }
Snehal
What problem are you having exactly? You might want to edit your question instead of commenting here, it will have a better format.
Joseph