1

Closed

readonly properties should throw

description

class TestClass
{
    public string Name
    {
        get { return "bar"; }
    }
}
...
        var scope = new FabricationScope();
        scope.Setup<TestClass>()
            .For(x => x.Name).Use("foo");
        var test = scope.Generate<TestClass>();
        Console.WriteLine(test.Name);
...

Expected: throw an exception
Actual: writes "bar"
Closed Mar 31, 2012 at 8:06 PM by JRoughan
An exception is now generated if a rule is created for a readonly property

comments