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
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Testing value objects
How to test things like immutability
Fran Iglesias
November 02, 2018
More Decks by Fran Iglesias
See All by Fran Iglesias
Tips for daily refactoring
franiglesias
0
370
Introduction to TDD: Red-Green-Refactor
franiglesias
1
330
testing the unpredictable
franiglesias
0
260
Tests doubles: the motion picture
franiglesias
0
560
Low cost techniques for test doubles
franiglesias
0
250
Other Decks in Programming
See All in Programming
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
250
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.1k
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
バグを直したら useEffect が消えた
colorful12
3
700
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.7k
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
450
リアルな遅延を測る仕様
kota_yata
1
120
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
1
720
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
400
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
540
Featured
See All Featured
The Curse of the Amulet
leimatthew05
2
14k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
490
How to train your dragon (web standard)
notwaldorf
97
6.8k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
440
How GitHub (no longer) Works
holman
316
150k
WCS-LA-2024
lcolladotor
0
800
Speed Design
sergeychernyshev
33
2k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
500
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
520
Practical Orchestrator
shlominoach
191
12k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
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