Unit testing value objects in isolation from its dependencies

前端 未结 3 2027
刺人心
刺人心 2021-01-14 01:39

TL;DR
How do you test a value object in isolation from its dependencies without stubbing or injecting them?


In Misko Hevery\'s blog post T

3条回答
  •  孤城傲影
    2021-01-14 02:15

    Avoid value types with dependencies on non-value types. Also avoid constructors that perform validations and throw exceptions. In your example I'd have a factory type that validates and creates quantities.

提交回复
热议问题