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
150
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
290
Introduction to TDD: Red-Green-Refactor
franiglesias
1
170
testing the unpredictable
franiglesias
0
140
Tests doubles: the motion picture
franiglesias
0
320
Low cost techniques for test doubles
franiglesias
0
120
Other Decks in Programming
See All in Programming
CSRF対策のやり方、そろそろアップデートしませんか / Update your knowledge of CSRF protection
hiro_y
25
15k
品質とスピードを両立: TypeScriptの柔軟な型システムをバックエンドで活用する
kosui
5
1.1k
Go1.22からの疑似乱数生成器について/go-122-pseudo-random-generator
convto
1
160
実践!RDRAを活用した既存システムの仕様変更 / Specification Changes in Existing Systems Utilizing RDRA
imamotohikaru
0
2.7k
ONE WEDGE_Company_Information
1wedge
0
180
Laravel OpenAPIによる"辛くない"スキーマ駆動開発
kentaroutakeda
2
2.1k
MySQL のインデックスの種類をおさらいしよう! / overviewing indexes in MySQL
okashoi
0
170
C# 大統一理論推進委員会 会員のための Unity Package Manager プロジェクト構成案
monry
PRO
0
580
生成 AI の中身を覗いてみよう〜基礎から医療現場での応用まで〜
soh9834
2
770
IntelliJ IDEA を知らなかった 自分に教えたい小ネタ集 / IntelliJ IDEA Hints for My Past Self
mackey0225
3
180
CircleCIを活用して AWSへの継続的デリバリーを 実践する
coconala_engineer
1
110
incrementalモデルの理解を深める
ikkimiyazaki
2
640
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
66
8.5k
Fantastic passwords and where to find them - at NoRuKo
philnash
35
2.4k
Designing the Hi-DPI Web
ddemaree
275
33k
Producing Creativity
orderedlist
PRO
335
39k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Designing on Purpose - Digital PM Summit 2013
jponch
109
6.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
The Invisible Side of Design
smashingmag
293
49k
How to train your dragon (web standard)
notwaldorf
71
5.1k
The Language of Interfaces
destraynor
150
23k
Design by the Numbers
sachag
274
18k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
1
1.2k
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