Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Testing value objects
Search
Fran Iglesias
November 02, 2018
Programming
0
190
Testing value objects
How to test things like immutability
Fran Iglesias
November 02, 2018
Tweet
Share
More Decks by Fran Iglesias
See All by Fran Iglesias
Tips for daily refactoring
franiglesias
0
310
Introduction to TDD: Red-Green-Refactor
franiglesias
1
210
testing the unpredictable
franiglesias
0
160
Tests doubles: the motion picture
franiglesias
0
410
Low cost techniques for test doubles
franiglesias
0
140
Other Decks in Programming
See All in Programming
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
200
Linux && Docker 研修/Linux && Docker training
forrep
16
3k
毎日13時間もかかるバッチ処理をたった3日で60%短縮するためにやったこと
sho_ssk_
1
660
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
940
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
190
Scaling your build logic
antalmonori
1
130
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
260
.NETでOBS Studio操作してみたけど…… / Operating OBS Studio by .NET
skasweb
0
130
Alba: Why, How and What's So Interesting
okuramasafumi
0
230
チームの立て直し施策をGoogleの 『効果的なチーム』と見比べてみた
maroon8021
0
150
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
180
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
350
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Statistics for Hackers
jakevdp
797
220k
Automating Front-end Workflow
addyosmani
1367
200k
Embracing the Ebb and Flow
colly
84
4.5k
Gamification - CAS2011
davidbonilla
80
5.1k
YesSQL, Process and Tooling at Scale
rocio
170
14k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
How GitHub (no longer) Works
holman
312
140k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
260
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
Transcript
TDD 101 2. TDDing Value Objects
TDDing Value Objects
Value Object (DDD) Small object Represents a concept Equality based
on value Immutable: • Should be created consistent • Mutators should return new instances
So… How do you TDD a VO?
TDD VO Think of an invalid example Write a test
that fails expecting exception Make the test pass Repeat as needed to test invalid cases
TDD VO Think of a valid example Write a test
that fails asserting value Make the test pass
TDD VO Equality Write a test that fails expecting inequality
Make the test pass Then write a test that fails expecting equality Make the test pass
TDD VO Immutability Think of a valid example of a
mutator Write a test that fails expecting a different instance Make the test pass
None