How to use AutoFixture to build with customized properties while keeping type customizations?

后端 未结 3 1741
深忆病人
深忆病人 2021-02-13 00:19

I am trying to use autofixture to create an object but there are certain properties that I want to always be defaulted (while the rest could be auto generated). However, wheneve

3条回答
  •  臣服心动
    2021-02-13 00:26

    This looks like it's by design:

    Note that the Build method chain is best understood as a one-off Customization. It bypasses all Customizations on the Fixture instance. Instead, it allows fine-grained control when building a specific specimen. However, in most cases, adding a convention-based ICustomization is a better, more flexible option.

    ...from the Build() method's documentation.

    I appreciate that this is probably not an ideal answer. However, the documentation does provide a hint as to how you might arrive at one.

提交回复
热议问题