Search code examples
rhino-mocksrhino

Rhino Mocks - Private Properties On Ctor Test


i have a very simple question , i'm new to rhino this is my class: i want to test the property with Expect.SetPropertyWithArgument

can anyone show me how, cuase i tried and its not working..

public class person
{    

    public string Name {get;private set;}

    public person(string name)
    {
        Name = name;
    }
}

Solution

  • The point of Expect.SetPropertyWithArguments is that a property is set on the mocked object, not on the object under test. I'd also point out that the code you've shown doesn't set a property at all - it's setting a field.