SlideShare una empresa de Scribd logo
1 de 19
Unit Testing in Action
C# NUnit, and Moq
15 Sep. 2021
Presented By &
Unit Testing in Action - C# NUnit, and Moq
XP Days xpdays.org is an initiative
for gathering people interested in
Agile, eXtreme Programming (aka:
XP), Scrum, Coding, etc.
XP is a lightweight, efficient, and low-
risk Agile Software Development
Framework intended to improve
software quality.
Agile Arena agilearena.net is an Agile
Consulting and Training company. specialized in
agile adoption and transformation for companies
and teams through:
• Designing their agile adoption programs
• Executing our programs and guiding the team
through their journey to sustainable agility .
• We also provide accredited training classes
for companies and individuals
This Webinar
is Held By:
Mohammed Shaban
Presented By &
AGENDA
• Unit Testing
• NUnit
• Moq
Unit Testing in Action - C# NUnit, and Moq
What we’ll be covering this webinar
Presented By &
What is automated testing?
• Automated testing is the practice of writing code to test our code, and then
run those tests in an automated fashion.
• Automated tests are repeatable
Unit Testing in Action - C# NUnit, and Moq
Presented By &
Why automated testing
• You can test our application code on a frequent basis and in less time.
• Catch bugs BEFORE deploying.
• Deploy with confidence.
• Refactor with confidence.
• Focus more on the quality.
* Refactoring means changing the structure of your code, without changing
its behavior.
Unit Testing in Action - C# NUnit, and Moq
Presented By &
Types of Automated Test
• Unit
• Test a unit of an application without its external dependencies.
• Cheap to write and fast to execute don’t give a lot of confidence.
• Integration
• Test the application with its dependencies.
• Take longer to execute and give more confidence.
• E2E
• Drives an application through its UI.
• Give you the greatest confidence and very slow and very brittle.
Unit Testing in Action - C# NUnit, and Moq
Presented By &
Testing framework
• NUnit
• MSTest
• xUnit
Unit Testing in Action - C# NUnit, and Moq
Presented By &
TDD
• With TDD you write your tests before writing the production code.
• Write a failing test.
• Write the simplest code to make the test pass.
• Refactor if necessary.
Unit Testing in Action - C# NUnit, and Moq
Presented By &
Benefits of TDD
• Testable source code.
• Full coverage by tests.
• Simpler implementation.
Unit Testing in Action - C# NUnit, and Moq
Presented By &
Good Unit Tests
• First class citizens.
• Clean , readable and maintainable.
• No logic.
• Isolated.
• Not too specific/general.
Unit Testing in Action - C# NUnit, and Moq
NUnit Demo
Presented By &
• Simple Unit Test
• Set Up and Tear Down
• Parameterized Tests
• Ignoring Tests
• Testing Strings
• Testing Arrays and Collections
• Testing the Return Type of Methods
• Testing Void Methods
• Testing Methods that Throw Exceptions
• Testing Methods that Raise an Event
• Testing Private Methods
Unit Testing in Action - C# NUnit, and Moq
NUnit Demo
Presented By &
• In software engineering, dependency injection is a technique whereby one
object (or static method) supplies the dependencies of another object. A
dependency is an object that can be used (a service).
Unit Testing in Action - C# NUnit, and Moq
DI
Presented By &
• Constructor Injection: In the constructor injection, the injector supplies the
service (dependency) through the client class constructor.
• Property Injection: In the property injection (aka the Setter Injection), the
injector supplies the dependency through a public property of the client
class.
• Method Injection: In this type of injection, the client class implements an
interface which declares the method(s) to supply the dependency and the
injector uses this interface to supply the dependency to the client class.
Unit Testing in Action - C# NUnit, and Moq
Types of dependency injection
Presented By &
• Moq
• NSubstitue
• FakeItEasy
• Rhino Mocks
Unit Testing in Action - C# NUnit, and Moq
Mocking Frameworks
Moq Demo
Presented By &
www.agilearena.net
www.xpdays.org
Unit Testing in Action - C# NUnit, and Moq
Presented By &
DISCUSSION
Unit Testing in Action - C#
NUnit, and Moq
OPEN DISUCSSION

Más contenido relacionado

La actualidad más candente

Dependency Injection in iOS
Dependency Injection in iOSDependency Injection in iOS
Dependency Injection in iOSPablo Villar
 
Agile Programming Systems # TDD intro
Agile Programming Systems # TDD introAgile Programming Systems # TDD intro
Agile Programming Systems # TDD introVitaliy Kulikov
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)nedirtv
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 
Unit testing
Unit testing Unit testing
Unit testing dubbu
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentMireia Sangalo
 
Unit testing legacy code
Unit testing legacy codeUnit testing legacy code
Unit testing legacy codeLars Thorup
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010guest5639fa9
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentShawn Jones
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testingikhwanhayat
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowRachid Kherrazi
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven developmenttoteb5
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Babul Mirdha
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove
 

La actualidad más candente (20)

Dependency Injection in iOS
Dependency Injection in iOSDependency Injection in iOS
Dependency Injection in iOS
 
Agile Programming Systems # TDD intro
Agile Programming Systems # TDD introAgile Programming Systems # TDD intro
Agile Programming Systems # TDD intro
 
TDD (Test Driven Design)
TDD (Test Driven Design)TDD (Test Driven Design)
TDD (Test Driven Design)
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Unit testing
Unit testing Unit testing
Unit testing
 
Unit Testing Your Application
Unit Testing Your ApplicationUnit Testing Your Application
Unit Testing Your Application
 
Unit tests benefits
Unit tests benefitsUnit tests benefits
Unit tests benefits
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Unit testing legacy code
Unit testing legacy codeUnit testing legacy code
Unit testing legacy code
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
 
TDD Basics with Angular.js and Jasmine
TDD Basics with Angular.js and JasmineTDD Basics with Angular.js and Jasmine
TDD Basics with Angular.js and Jasmine
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testing
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Behavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlowBehavior Driven Development with SpecFlow
Behavior Driven Development with SpecFlow
 
Scrum and Test-driven development
Scrum and Test-driven developmentScrum and Test-driven development
Scrum and Test-driven development
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
 

Similar a Unit Testing in Action - C#, NUnit, and Moq

An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitweili_at_slideshare
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design Jayant Dalvi
 
Software testing concepts
Software testing conceptsSoftware testing concepts
Software testing conceptssatyatwrmca
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and typesConfiz
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit TestingSahar Nofal
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnitsatejsahu
 
Shift Remote: Mobile - Efficiently Building Native Frameworks for Multiple Pl...
Shift Remote: Mobile - Efficiently Building Native Frameworks for Multiple Pl...Shift Remote: Mobile - Efficiently Building Native Frameworks for Multiple Pl...
Shift Remote: Mobile - Efficiently Building Native Frameworks for Multiple Pl...Shift Conference
 
Appmotives - Software Testing As Service
Appmotives - Software Testing As ServiceAppmotives - Software Testing As Service
Appmotives - Software Testing As ServiceKalyan Paluri
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software TestingMohammed Moishin
 
Accelerating tests with Cypress for a leaderboard platform
Accelerating tests with Cypress for a leaderboard platformAccelerating tests with Cypress for a leaderboard platform
Accelerating tests with Cypress for a leaderboard platformKnoldus Inc.
 
software testing
 software testing software testing
software testingSara shall
 
Client Side Unit Testing
Client Side Unit TestingClient Side Unit Testing
Client Side Unit Testingcloud chen
 
Enter the mind of an Agile Developer
Enter the mind of an Agile DeveloperEnter the mind of an Agile Developer
Enter the mind of an Agile DeveloperBSGAfrica
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Jacinto Limjap
 
manualtesting-170218090020 (1).pdf
manualtesting-170218090020 (1).pdfmanualtesting-170218090020 (1).pdf
manualtesting-170218090020 (1).pdfperamdevi06
 
Manual Testing software testing all slide
Manual Testing software testing all slideManual Testing software testing all slide
Manual Testing software testing all slideSmileySmiley39
 
Battle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectBattle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectGlobalLogic Ukraine
 

Similar a Unit Testing in Action - C#, NUnit, and Moq (20)

Testing Best Practices
Testing Best PracticesTesting Best Practices
Testing Best Practices
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnit
 
Structured system analysis and design
Structured system analysis and design Structured system analysis and design
Structured system analysis and design
 
Software testing concepts
Software testing conceptsSoftware testing concepts
Software testing concepts
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnit
 
Shift Remote: Mobile - Efficiently Building Native Frameworks for Multiple Pl...
Shift Remote: Mobile - Efficiently Building Native Frameworks for Multiple Pl...Shift Remote: Mobile - Efficiently Building Native Frameworks for Multiple Pl...
Shift Remote: Mobile - Efficiently Building Native Frameworks for Multiple Pl...
 
Appmotives - Software Testing As Service
Appmotives - Software Testing As ServiceAppmotives - Software Testing As Service
Appmotives - Software Testing As Service
 
Agile Testing - What is it?
Agile Testing - What is it?Agile Testing - What is it?
Agile Testing - What is it?
 
Agile Testing
Agile Testing  Agile Testing
Agile Testing
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
 
Accelerating tests with Cypress for a leaderboard platform
Accelerating tests with Cypress for a leaderboard platformAccelerating tests with Cypress for a leaderboard platform
Accelerating tests with Cypress for a leaderboard platform
 
software testing
 software testing software testing
software testing
 
Client Side Unit Testing
Client Side Unit TestingClient Side Unit Testing
Client Side Unit Testing
 
Enter the mind of an Agile Developer
Enter the mind of an Agile DeveloperEnter the mind of an Agile Developer
Enter the mind of an Agile Developer
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
 
manualtesting-170218090020 (1).pdf
manualtesting-170218090020 (1).pdfmanualtesting-170218090020 (1).pdf
manualtesting-170218090020 (1).pdf
 
Manual Testing software testing all slide
Manual Testing software testing all slideManual Testing software testing all slide
Manual Testing software testing all slide
 
Battle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectBattle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java Project
 

Más de XPDays

Change the Conversation! Unleash Your Potential in a Complex World.pptx
Change the Conversation! Unleash Your Potential in a Complex World.pptxChange the Conversation! Unleash Your Potential in a Complex World.pptx
Change the Conversation! Unleash Your Potential in a Complex World.pptxXPDays
 
Agile Culture Transformation
Agile Culture TransformationAgile Culture Transformation
Agile Culture TransformationXPDays
 
Re-engineering Technology to break barriers with Business
Re-engineering Technology to break barriers with BusinessRe-engineering Technology to break barriers with Business
Re-engineering Technology to break barriers with BusinessXPDays
 
Practicing Red, Green, Refactor!
Practicing Red, Green, Refactor!Practicing Red, Green, Refactor!
Practicing Red, Green, Refactor!XPDays
 
Ready, Steady, Sprint
Ready, Steady, SprintReady, Steady, Sprint
Ready, Steady, SprintXPDays
 
The Whole Story of The User Story
The Whole Story of The User StoryThe Whole Story of The User Story
The Whole Story of The User StoryXPDays
 
Scrum Master Facilitation Techniques
Scrum Master Facilitation TechniquesScrum Master Facilitation Techniques
Scrum Master Facilitation TechniquesXPDays
 
An Introduction to The Cynefin Framework
An Introduction to The Cynefin FrameworkAn Introduction to The Cynefin Framework
An Introduction to The Cynefin FrameworkXPDays
 
Team Mental Health
Team Mental HealthTeam Mental Health
Team Mental HealthXPDays
 
Business Analyst in the Agile Space
Business Analyst in the Agile SpaceBusiness Analyst in the Agile Space
Business Analyst in the Agile SpaceXPDays
 
DevOps in action - Azure DevOps
DevOps in action - Azure DevOpsDevOps in action - Azure DevOps
DevOps in action - Azure DevOpsXPDays
 
Priotrization techniques
Priotrization techniquesPriotrization techniques
Priotrization techniquesXPDays
 
Scaled Agile Framework
Scaled Agile FrameworkScaled Agile Framework
Scaled Agile FrameworkXPDays
 
Building Team Habits
Building Team HabitsBuilding Team Habits
Building Team HabitsXPDays
 
4 Keys to Success in your Agile Journey
4 Keys to Success in your Agile Journey4 Keys to Success in your Agile Journey
4 Keys to Success in your Agile JourneyXPDays
 
Coaching stances
Coaching stancesCoaching stances
Coaching stancesXPDays
 
Re-focus for Agile leaders
Re-focus for Agile leadersRe-focus for Agile leaders
Re-focus for Agile leadersXPDays
 
Business Decomposition
Business DecompositionBusiness Decomposition
Business DecompositionXPDays
 
Agile projects | Prioritization
Agile projects | PrioritizationAgile projects | Prioritization
Agile projects | PrioritizationXPDays
 
Scaling Agile | Spotify
Scaling Agile | SpotifyScaling Agile | Spotify
Scaling Agile | SpotifyXPDays
 

Más de XPDays (20)

Change the Conversation! Unleash Your Potential in a Complex World.pptx
Change the Conversation! Unleash Your Potential in a Complex World.pptxChange the Conversation! Unleash Your Potential in a Complex World.pptx
Change the Conversation! Unleash Your Potential in a Complex World.pptx
 
Agile Culture Transformation
Agile Culture TransformationAgile Culture Transformation
Agile Culture Transformation
 
Re-engineering Technology to break barriers with Business
Re-engineering Technology to break barriers with BusinessRe-engineering Technology to break barriers with Business
Re-engineering Technology to break barriers with Business
 
Practicing Red, Green, Refactor!
Practicing Red, Green, Refactor!Practicing Red, Green, Refactor!
Practicing Red, Green, Refactor!
 
Ready, Steady, Sprint
Ready, Steady, SprintReady, Steady, Sprint
Ready, Steady, Sprint
 
The Whole Story of The User Story
The Whole Story of The User StoryThe Whole Story of The User Story
The Whole Story of The User Story
 
Scrum Master Facilitation Techniques
Scrum Master Facilitation TechniquesScrum Master Facilitation Techniques
Scrum Master Facilitation Techniques
 
An Introduction to The Cynefin Framework
An Introduction to The Cynefin FrameworkAn Introduction to The Cynefin Framework
An Introduction to The Cynefin Framework
 
Team Mental Health
Team Mental HealthTeam Mental Health
Team Mental Health
 
Business Analyst in the Agile Space
Business Analyst in the Agile SpaceBusiness Analyst in the Agile Space
Business Analyst in the Agile Space
 
DevOps in action - Azure DevOps
DevOps in action - Azure DevOpsDevOps in action - Azure DevOps
DevOps in action - Azure DevOps
 
Priotrization techniques
Priotrization techniquesPriotrization techniques
Priotrization techniques
 
Scaled Agile Framework
Scaled Agile FrameworkScaled Agile Framework
Scaled Agile Framework
 
Building Team Habits
Building Team HabitsBuilding Team Habits
Building Team Habits
 
4 Keys to Success in your Agile Journey
4 Keys to Success in your Agile Journey4 Keys to Success in your Agile Journey
4 Keys to Success in your Agile Journey
 
Coaching stances
Coaching stancesCoaching stances
Coaching stances
 
Re-focus for Agile leaders
Re-focus for Agile leadersRe-focus for Agile leaders
Re-focus for Agile leaders
 
Business Decomposition
Business DecompositionBusiness Decomposition
Business Decomposition
 
Agile projects | Prioritization
Agile projects | PrioritizationAgile projects | Prioritization
Agile projects | Prioritization
 
Scaling Agile | Spotify
Scaling Agile | SpotifyScaling Agile | Spotify
Scaling Agile | Spotify
 

Último

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 

Último (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 

Unit Testing in Action - C#, NUnit, and Moq

  • 1. Unit Testing in Action C# NUnit, and Moq 15 Sep. 2021
  • 2. Presented By & Unit Testing in Action - C# NUnit, and Moq XP Days xpdays.org is an initiative for gathering people interested in Agile, eXtreme Programming (aka: XP), Scrum, Coding, etc. XP is a lightweight, efficient, and low- risk Agile Software Development Framework intended to improve software quality. Agile Arena agilearena.net is an Agile Consulting and Training company. specialized in agile adoption and transformation for companies and teams through: • Designing their agile adoption programs • Executing our programs and guiding the team through their journey to sustainable agility . • We also provide accredited training classes for companies and individuals
  • 3. This Webinar is Held By: Mohammed Shaban
  • 4. Presented By & AGENDA • Unit Testing • NUnit • Moq Unit Testing in Action - C# NUnit, and Moq What we’ll be covering this webinar
  • 5. Presented By & What is automated testing? • Automated testing is the practice of writing code to test our code, and then run those tests in an automated fashion. • Automated tests are repeatable Unit Testing in Action - C# NUnit, and Moq
  • 6. Presented By & Why automated testing • You can test our application code on a frequent basis and in less time. • Catch bugs BEFORE deploying. • Deploy with confidence. • Refactor with confidence. • Focus more on the quality. * Refactoring means changing the structure of your code, without changing its behavior. Unit Testing in Action - C# NUnit, and Moq
  • 7. Presented By & Types of Automated Test • Unit • Test a unit of an application without its external dependencies. • Cheap to write and fast to execute don’t give a lot of confidence. • Integration • Test the application with its dependencies. • Take longer to execute and give more confidence. • E2E • Drives an application through its UI. • Give you the greatest confidence and very slow and very brittle. Unit Testing in Action - C# NUnit, and Moq
  • 8. Presented By & Testing framework • NUnit • MSTest • xUnit Unit Testing in Action - C# NUnit, and Moq
  • 9. Presented By & TDD • With TDD you write your tests before writing the production code. • Write a failing test. • Write the simplest code to make the test pass. • Refactor if necessary. Unit Testing in Action - C# NUnit, and Moq
  • 10. Presented By & Benefits of TDD • Testable source code. • Full coverage by tests. • Simpler implementation. Unit Testing in Action - C# NUnit, and Moq
  • 11. Presented By & Good Unit Tests • First class citizens. • Clean , readable and maintainable. • No logic. • Isolated. • Not too specific/general. Unit Testing in Action - C# NUnit, and Moq
  • 13. Presented By & • Simple Unit Test • Set Up and Tear Down • Parameterized Tests • Ignoring Tests • Testing Strings • Testing Arrays and Collections • Testing the Return Type of Methods • Testing Void Methods • Testing Methods that Throw Exceptions • Testing Methods that Raise an Event • Testing Private Methods Unit Testing in Action - C# NUnit, and Moq NUnit Demo
  • 14. Presented By & • In software engineering, dependency injection is a technique whereby one object (or static method) supplies the dependencies of another object. A dependency is an object that can be used (a service). Unit Testing in Action - C# NUnit, and Moq DI
  • 15. Presented By & • Constructor Injection: In the constructor injection, the injector supplies the service (dependency) through the client class constructor. • Property Injection: In the property injection (aka the Setter Injection), the injector supplies the dependency through a public property of the client class. • Method Injection: In this type of injection, the client class implements an interface which declares the method(s) to supply the dependency and the injector uses this interface to supply the dependency to the client class. Unit Testing in Action - C# NUnit, and Moq Types of dependency injection
  • 16. Presented By & • Moq • NSubstitue • FakeItEasy • Rhino Mocks Unit Testing in Action - C# NUnit, and Moq Mocking Frameworks
  • 18. Presented By & www.agilearena.net www.xpdays.org Unit Testing in Action - C# NUnit, and Moq
  • 19. Presented By & DISCUSSION Unit Testing in Action - C# NUnit, and Moq OPEN DISUCSSION