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
180
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
200
testing the unpredictable
franiglesias
0
160
Tests doubles: the motion picture
franiglesias
0
390
Low cost techniques for test doubles
franiglesias
0
140
Other Decks in Programming
See All in Programming
Remix on Hono on Cloudflare Workers
yusukebe
1
290
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
100
CSC509 Lecture 09
javiergs
PRO
0
140
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
Better Code Design in PHP
afilina
PRO
0
130
Realtime API 入門
riofujimon
0
150
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
How STYLIGHT went responsive
nonsquared
95
5.2k
Side Projects
sachag
452
42k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Why Our Code Smells
bkeepers
PRO
334
57k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Into the Great Unknown - MozCon
thekraken
32
1.5k
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