Autofixture - how to setup readonly property with some value

28 Views Asked by At

I need somehow specify my own value for public read-only property in the tested class

With Moq I can use something like

moq.SetupGet(m=>m.SomeReadOnlyProps).Returns(value)

then I can use it in the test.

With AutoFixture- I can't do this, since it said that it is read-only:

var sut = _fixture.Build<SomeClass>()
     .With(m=>m.SomeReadonlyProperty, value) // here I got exception 
     .Create();

Can somebody guide me to use the proper approach for setup read-only property with the usage AutoFixture?

0

There are 0 best solutions below