Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
250
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
340
Introduction to TDD: Red-Green-Refactor
franiglesias
1
270
testing the unpredictable
franiglesias
0
220
Tests doubles: the motion picture
franiglesias
0
490
Low cost techniques for test doubles
franiglesias
0
200
Other Decks in Programming
See All in Programming
配送計画の均等化機能を提供する取り組みについて(⽩⾦鉱業 Meetup Vol.21@六本⽊(数理最適化編))
izu_nori
0
150
開発に寄りそう自動テストの実現
goyoki
2
970
AIコーディングエージェント(NotebookLM)
kondai24
0
190
Cap'n Webについて
yusukebe
0
130
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
330
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
3
730
AIコーディングエージェント(Manus)
kondai24
0
180
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
420
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
390
認証・認可の基本を学ぼう後編
kouyuume
0
190
ゲームの物理 剛体編
fadis
0
350
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
120
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Optimizing for Happiness
mojombo
379
70k
Thoughts on Productivity
jonyablonski
73
5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.3k
Docker and Python
trallard
47
3.7k
Code Reviewing Like a Champion
maltzj
527
40k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
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