AutoFixture: mock methods don't return a frozen instance

前端 未结 2 426
孤街浪徒
孤街浪徒 2021-01-05 17:23

I\'m trying to write this simple test:

var fixture = new Fixture().Customize(new AutoMoqCustomization());

var pos         


        
2条回答
  •  佛祖请我去吃肉
    2021-01-05 18:07

    As of 3.20.0, you can use AutoConfiguredMoqCustomization. This will automatically configure all mocks so that their members' return values are generated by AutoFixture.

    In other words, it will auto-configure your postProcessingActionReader to return the frozen postProcessingAction.

    Just change this:

    var fixture = new Fixture().Customize(new AutoMoqCustomization());
    

    to this:

    var fixture = new Fixture().Customize(new AutoConfiguredMoqCustomization());
    

提交回复
热议问题