SlideShare a Scribd company logo
WHY
FAKE IT
WHEN YOU CAN
FAKE IT EASY
Dan
Stroh

• Husband
• Father
• Software developer for
Meta Payment
Systems

• Home brewer
• Stat guy
AGENDA
• Goals
• Anatomy of a Unit Test
• Pillars of Unit Testing
• Unit testing
Development Practices

• Inversion of control

• Fakes, Mocks,
Stubs

• Mocking
Frameworks

• FakeItEasy
• Recap
• Questions
GOALS
• Write good unit tests
• Know what a good unit test looks like
• Use a mocking framework
ANATOMY OF A UNIT TEST
A
A
A
ARRANGE
ACT
ASSERT
PILLARS OF UNIT TESTING
UNIT TESTING DEVELOPMENT PRACTICES
TAD
TEST AFTER DEVELOPMENT
TDD
TEST DRIVEN DEVELOPMENT
BDD
BEHAVIOR DRIVEN DEVELOPMENT
FAKES, MOCKS, AND STUBS
INVERSION OF CONTROL
CONSTRUCTOR INJECTION
PROPERTY INJECTION
ARGUMENT INJECTION
MOCKING FRAMEWORKS
FakeItEasy
(nuget) github.com/fakeiteasy
Rhino Mocks
(nuget) hibernatingrhinos.com/oss/rhino-mocks
Moq
(nuget) github.com/Moq
Microsoft Fakes
msdn.microsoft.com/en-us/library/hh549175%28v=vs.110%29.aspx
TypeMocks
typemock.com
JustMock
(nuget) telerik.com/products/mocking.aspx
Nmock
(nuget) nmock3.codeplex.com
Nsubstitute (nuget) nsubstitute.github.io/
EasyMock .Net
sourceforge.net/projects/easymocknet/
FAKEITEASY
RECAP
WRITE GOOD UNIT TESTS
KNOW WHAT A GOOD UNIT TEST LOOKS
LIKE
USE A MOCKING FRAMEWORK
QUESTIONS
STROH.SD@GMAIL.COM
THANK YOU

More Related Content

Viewers also liked

SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC
SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC
SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC chelliah paramasivan
 
Marx, karl el capital i (parte 1)
Marx, karl   el capital i (parte 1)Marx, karl   el capital i (parte 1)
Marx, karl el capital i (parte 1)Clotilde Rivera
 
Metodologias investigacion
Metodologias investigacionMetodologias investigacion
Metodologias investigacionClotilde Rivera
 
Metodología de la investigación módulo i- niveles de investigación
Metodología de la investigación módulo i- niveles de investigaciónMetodología de la investigación módulo i- niveles de investigación
Metodología de la investigación módulo i- niveles de investigaciónClotilde Rivera
 
Francis bacon - novum organum
Francis bacon - novum organumFrancis bacon - novum organum
Francis bacon - novum organumClotilde Rivera
 
Metodología de la investigación h- sampieri (5ta edición)
Metodología de la investigación   h- sampieri (5ta edición)Metodología de la investigación   h- sampieri (5ta edición)
Metodología de la investigación h- sampieri (5ta edición)Clotilde Rivera
 
Proceso logistico de coca cola
Proceso logistico de coca colaProceso logistico de coca cola
Proceso logistico de coca colaNury_Bohorquez_R
 
Modelo de espectaticas de victor vroom
Modelo de espectaticas de victor  vroomModelo de espectaticas de victor  vroom
Modelo de espectaticas de victor vroomJluis Salazar
 
1 читательский дневник
1 читательский  дневник1 читательский  дневник
1 читательский дневникAlexander Tolstikov
 
Fotográfica Bogotá - Tríptico final a color
Fotográfica Bogotá - Tríptico final a colorFotográfica Bogotá - Tríptico final a color
Fotográfica Bogotá - Tríptico final a color
Geraldine Chauca Escobar
 

Viewers also liked (10)

SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC
SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC
SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC
 
Marx, karl el capital i (parte 1)
Marx, karl   el capital i (parte 1)Marx, karl   el capital i (parte 1)
Marx, karl el capital i (parte 1)
 
Metodologias investigacion
Metodologias investigacionMetodologias investigacion
Metodologias investigacion
 
Metodología de la investigación módulo i- niveles de investigación
Metodología de la investigación módulo i- niveles de investigaciónMetodología de la investigación módulo i- niveles de investigación
Metodología de la investigación módulo i- niveles de investigación
 
Francis bacon - novum organum
Francis bacon - novum organumFrancis bacon - novum organum
Francis bacon - novum organum
 
Metodología de la investigación h- sampieri (5ta edición)
Metodología de la investigación   h- sampieri (5ta edición)Metodología de la investigación   h- sampieri (5ta edición)
Metodología de la investigación h- sampieri (5ta edición)
 
Proceso logistico de coca cola
Proceso logistico de coca colaProceso logistico de coca cola
Proceso logistico de coca cola
 
Modelo de espectaticas de victor vroom
Modelo de espectaticas de victor  vroomModelo de espectaticas de victor  vroom
Modelo de espectaticas de victor vroom
 
1 читательский дневник
1 читательский  дневник1 читательский  дневник
1 читательский дневник
 
Fotográfica Bogotá - Tríptico final a color
Fotográfica Bogotá - Tríptico final a colorFotográfica Bogotá - Tríptico final a color
Fotográfica Bogotá - Tríptico final a color
 

Similar to Why just fake it

[DevSecOps Live] DevSecOps: Challenges and Opportunities
[DevSecOps Live] DevSecOps: Challenges and Opportunities[DevSecOps Live] DevSecOps: Challenges and Opportunities
[DevSecOps Live] DevSecOps: Challenges and Opportunities
Mohammed A. Imran
 
Unit testing for Cocoa developers
Unit testing for Cocoa developersUnit testing for Cocoa developers
Unit testing for Cocoa developers
Graham Lee
 
Software Architecture: Test Case Writing
Software Architecture: Test Case WritingSoftware Architecture: Test Case Writing
Software Architecture: Test Case WritingSitdhibong Laokok
 
Acceptance testfurureinmind
Acceptance testfurureinmindAcceptance testfurureinmind
Acceptance testfurureinmindLeanDog
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application Testing
Ynon Perek
 
Devday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvuDevday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvu
Phat VU
 
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
FINOS
 
What CS Class Didn't Teach About Testing
What CS Class Didn't Teach About TestingWhat CS Class Didn't Teach About Testing
What CS Class Didn't Teach About Testing
Camille Bell
 
Design For Testability
Design For TestabilityDesign For Testability
Design For Testability
Will Iverson
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
Danny Preussler
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automation
Elias Nogueira
 
Anatomy of Test Driven Development
Anatomy of Test Driven DevelopmentAnatomy of Test Driven Development
Anatomy of Test Driven Development
Dhaval Shah
 
prdc10-tdd-patterns
prdc10-tdd-patternsprdc10-tdd-patterns
prdc10-tdd-patternsAmir Barylko
 
Completely Test-Driven
Completely Test-DrivenCompletely Test-Driven
Completely Test-Driven
Ian Truslove
 
Introduction to unit testing
Introduction to unit testingIntroduction to unit testing
Introduction to unit testingGil Zilberfeld
 
Unit Testing in JavaScript
Unit Testing in JavaScriptUnit Testing in JavaScript
Unit Testing in JavaScript
Rob Scaduto
 
Practical (J)Unit Testing (2009)
Practical (J)Unit Testing (2009)Practical (J)Unit Testing (2009)
Practical (J)Unit Testing (2009)Peter Kofler
 
Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014Pedro Santos
 
'An Evolution Into Specification By Example' by Adam Knight
'An Evolution Into Specification By Example' by Adam Knight'An Evolution Into Specification By Example' by Adam Knight
'An Evolution Into Specification By Example' by Adam Knight
TEST Huddle
 
Taking a Test Drive: iOS Dev UK guide to TDD
Taking a Test Drive: iOS Dev UK guide to TDDTaking a Test Drive: iOS Dev UK guide to TDD
Taking a Test Drive: iOS Dev UK guide to TDD
Graham Lee
 

Similar to Why just fake it (20)

[DevSecOps Live] DevSecOps: Challenges and Opportunities
[DevSecOps Live] DevSecOps: Challenges and Opportunities[DevSecOps Live] DevSecOps: Challenges and Opportunities
[DevSecOps Live] DevSecOps: Challenges and Opportunities
 
Unit testing for Cocoa developers
Unit testing for Cocoa developersUnit testing for Cocoa developers
Unit testing for Cocoa developers
 
Software Architecture: Test Case Writing
Software Architecture: Test Case WritingSoftware Architecture: Test Case Writing
Software Architecture: Test Case Writing
 
Acceptance testfurureinmind
Acceptance testfurureinmindAcceptance testfurureinmind
Acceptance testfurureinmind
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application Testing
 
Devday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvuDevday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvu
 
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
 
What CS Class Didn't Teach About Testing
What CS Class Didn't Teach About TestingWhat CS Class Didn't Teach About Testing
What CS Class Didn't Teach About Testing
 
Design For Testability
Design For TestabilityDesign For Testability
Design For Testability
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automation
 
Anatomy of Test Driven Development
Anatomy of Test Driven DevelopmentAnatomy of Test Driven Development
Anatomy of Test Driven Development
 
prdc10-tdd-patterns
prdc10-tdd-patternsprdc10-tdd-patterns
prdc10-tdd-patterns
 
Completely Test-Driven
Completely Test-DrivenCompletely Test-Driven
Completely Test-Driven
 
Introduction to unit testing
Introduction to unit testingIntroduction to unit testing
Introduction to unit testing
 
Unit Testing in JavaScript
Unit Testing in JavaScriptUnit Testing in JavaScript
Unit Testing in JavaScript
 
Practical (J)Unit Testing (2009)
Practical (J)Unit Testing (2009)Practical (J)Unit Testing (2009)
Practical (J)Unit Testing (2009)
 
Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014
 
'An Evolution Into Specification By Example' by Adam Knight
'An Evolution Into Specification By Example' by Adam Knight'An Evolution Into Specification By Example' by Adam Knight
'An Evolution Into Specification By Example' by Adam Knight
 
Taking a Test Drive: iOS Dev UK guide to TDD
Taking a Test Drive: iOS Dev UK guide to TDDTaking a Test Drive: iOS Dev UK guide to TDD
Taking a Test Drive: iOS Dev UK guide to TDD
 

Recently uploaded

Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 

Recently uploaded (20)

Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 

Why just fake it