Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
C# and .NET Core Test-Driven Development
C# and .NET Core Test-Driven Development

C# and .NET Core Test-Driven Development: Dive into TDD to create flexible, maintainable, and production-ready .NET Core applications

eBook
R$49.99 R$196.99
Paperback
R$245.99
Subscription
Free Trial
Renews at R$50p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

C# and .NET Core Test-Driven Development

Getting Started with .NET Core

When Microsoft released the first version of .NET Framework, a platform for creating, running, and deploying services and applications, it was a game changer and a revolution in the Microsoft development community. Several cutting-edge applications were developed with the initial version of the framework and then several versions were released afterwards.

.NET Framework has thrived and matured over the years with support for multiple programming languages and the inclusion of several features to make programming on the platform easy and worthwhile. But as robust and appealing the framework is, there is the limitation of restricting the development and deployment of applications to Microsoft-only operating system variants.

In order to create a cloud-optimized, cross-platform implementation of .NET Framework for developers to solve the limitations...

.NET Core framework

.NET Core is a cross-platform open source development framework that runs on Windows, Linux, and macOS and cross architecture with support for x86, x64, and ARM. .NET Core was forked from .NET Framework, which technically makes it a subset of the latter, though streamlined line, and modular. .NET Core is a development platform that gives you great flexibility in developing and deploying applications. The new platform frees you from hassles usually experienced during application deployment. Thus, you don't have to worry about managing versions of application runtime on deployment servers.

Currently, in Version 2.0.7, .NET Core includes the .NET runtime with great performance and many features. Microsoft claims it's the fastest version of .NET platform. It has more APIs and more project templates have been added, such as those for developing ReactJS...

Structure of a .NET Core application

With the release of .NET Core 2.0, new templates were added, providing more options for the different application types that can be run on the platform. In addition to the existing project templates, the following single-page application (SPA) templates were added:

  • Angular
  • ReactJS
  • ReactJS and Redux

The console application in .NET Core has a similar structure to that of .NET Framework, whereas ASP.NET Core has several new components, including folders and files, that were not in the previous versions of ASP.NET.

ASP.NET Core MVC project structure

ASP.NET web framework has fully matured over the years, transitioning from web forms to MVC and Web API. ASP.NET core is a new web framework...

Tour of Microsoft's Visual Studio Code editor

Developing .NET Core applications has been made much easier, not only because of the sleekness and robustness of the platform but also through the introduction of Visual Studio Code, a cross-platform editor that runs on Windows, Linux, and macOS. You don't need to have Visual Studio IDE installed on your system before you can create applications on .NET Core.

Visual Studio Code, though not as powerful and features-packed as the Visual Studio IDE, does have in-built productivity tools and features that make creating .NET Core applications with it seamless. You can also install extensions for several programming languages from Visual Studio Marketplace into Visual Studio Code, giving you the flexibility to edit code written in other programming languages.

...

A look at the new features of C# 7

The C# programming language has matured over the years; more language features and constructs are being added with the release of each version. A language that originally was only being developed in house by Microsoft and run only on Windows operating systems is now open source and cross-platform. This is made possible through .NET Core and Version 7 (7.0 and 7.1) of the language, which added flavors and improved the available features of the language. The roadmap of the language, especially Version 7.2 and 8.0, promises to add more features to the language.

Tuples enhancement

Tuples were introduced into C# language in Version 4 and are used in the simplified form to provide structure with...

Creating an ASP.NET MVC Core application

ASP.NET Core provides an elegant way of building web applications and APIs that run on Windows, Linux, and macOS, owing to the .NET Core platform's tool and SDK that simplify developing cutting-edge applications and support side-by-side with application versioning. With ASP.NET Core, your applications have a smaller surface area which improves performance as you only have to include the NuGet packages required to run your applications. ASP.NET Core can also be integrated with client-side libraries and frameworks, allowing you to develop web applications using the CSS and JS libraries you are already familiar with.

ASP.NET Core runs with Kestrel, a web server included in the ASP.NET Core project templates. Kestrel is an in-process cross-platform HTTP server implementation based on libuv, a cross-platform asynchronous I/O library that...

Summary

The .NET Core platform, though new, is rapidly maturing, with Version 2.0.7 introducing many features and enhancements that simplify building different types of cross-platform applications. In this chapter, we have taken a tour of the platform, introduced the new features of C# 7, and set up a development environment on Ubuntu Linux, while creating our first ASP.NET MVC Core application.

In the next chapter, we will explain what to look out for in order to avoid writing codes that are untestable and we will later walk you through SOLID principles that can help you write testable and quality code.

Left arrow icon Right arrow icon

Key benefits

  • • Create tests to quickly detect and resolve issues when writing portable code
  • • Uncover code integration issues that improve code quality using continuous integration
  • • Set up and use data-driven unit testing to verify your code

Description

This book guides developers to create robust, production-ready C# 7 and .NET Core applications through the practice of test-driven development process. In C# and .NET Core Test-Driven Development, you will learn the different stages of the TDD life cycle, basics of TDD, best practices, and anti-patterns. It will teach you how to create an ASP.NET Core MVC sample application, write testable code with SOLID principles and set up a dependency injection for your sample application. Next, you will learn the xUnit testing framework and learn how to use its attributes and assertions. You’ll see how to create data-driven unit tests and mock dependencies in your code. You will understand the difference between running and debugging your tests on .NET Core on LINUX versus Windows and Visual Studio. As you move forward, you will be able to create a healthy continuous integration process for your sample application using GitHub, TeamCity, Cake, and Microsoft VSTS. By the end of this book, you will have learned how to write clean and robust code through the effective practice of TDD, set up CI build steps to test and build applications as well as how to package application for deployment on NuGet.

Who is this book for?

This book is for .NET developers who would like to build efficient applications by implementing principles of test-driven development. C# programming and working knowledge of VS is assumed.

What you will learn

  • • Write flexible, maintainable, and verifiable code for .NET Core
  • • Write testable code using SOLID principles and dependency injections
  • • Recognize the characteristics of a good unit test
  • • Structure and group your unit test
  • • Use mock objects to handle dependencies
  • • Set up an end-to-end continuous integration process

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 18, 2018
Length: 300 pages
Edition : 1st
Language : English
ISBN-13 : 9781788299923
Vendor :
Microsoft
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 18, 2018
Length: 300 pages
Edition : 1st
Language : English
ISBN-13 : 9781788299923
Vendor :
Microsoft
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
R$50 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
R$500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts
R$800 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total R$ 764.97
C# 7 and .NET Core 2.0 High Performance
R$272.99
C# and .NET Core Test-Driven Development
R$245.99
Building RESTful Web Services with .NET Core
R$245.99
Total R$ 764.97 Stars icon
Banner background image

Table of Contents

10 Chapters
Exploring Test-Driven Development Chevron down icon Chevron up icon
Getting Started with .NET Core Chevron down icon Chevron up icon
Writing Testable Code Chevron down icon Chevron up icon
.NET Core Unit Testing Chevron down icon Chevron up icon
Data-Driven Unit Tests Chevron down icon Chevron up icon
Mocking Dependencies Chevron down icon Chevron up icon
Continuous Integration and Project Hosting Chevron down icon Chevron up icon
Creating Continuous Integration Build Processes Chevron down icon Chevron up icon
Testing and Packaging the Application Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(7 Ratings)
5 star 28.6%
4 star 14.3%
3 star 14.3%
2 star 14.3%
1 star 28.6%
Filter icon Filter
Top Reviews

Filter reviews by




RAYMONDO Jan 21, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a great read thoroughly enjoying it. Yes there might be a lot of theory but its very important information on how and what to use rather than just following a book full of examples that dont explain in great detail.
Amazon Verified review Amazon
Zayne Frauendorf Jul 23, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I purchased this book. I've read about half of it now and i'm very impressed with the simplicity in which tough coding concepts are explained. The examples provided are excellent and help to drive the authors point across. This book has taught me clean coding principles, SOLID and writing testable code.
Amazon Verified review Amazon
Documentary Watcher Jun 10, 2019
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
A good intro to TDD which presents some decent points about how to refactor code and design tests. The one caveat is that it it based heavily on xUnit so if your organization requires MSTest or nUnit, you will need to translate thought processes a bit.
Amazon Verified review Amazon
treesa Mar 19, 2020
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Good coverage on xUnit. With it also covered MSTest and NUnit. Coverage of TeamCity and Cale was too light. Wish it covered Jenkins.
Amazon Verified review Amazon
Anthony Mar 17, 2021
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
This has to be one of the worst technical books I have ever read. Although having said that, if you’re wanting to get details on TDD and testing in C# it will probably tell you what you need to know.The issue with it is the structure. Early on for example it goes through some examples of bad coding - quite a few, and I was left wondering so what would be better? Well eventually the author gets around to some brief examples of better practices but rather than this is bad, do thing instead, bad do this instead etc it’s all lumped together and the good examples don’t have a whole lot of explaining why they’re better.The bad structure continues often using terms that the book seems to expect you to know, which several chapters later it then goes on to explain.Another issue is the level of detail on many things - or lack of it. I found a lot of it to be factual statements strung together rather detailed explanation. Whilst towards the end the book spends multiple chapters going into great detail on the Cake build automation system. I’d have been happier with less detail on that and far more on more fundamental things like integration testing.Overall, it’s a tough read that you may benefit from reading cover to cover multiple times to make up for the structure issues.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.