Skip to Content
Concurrency in C# Cookbook
book

Concurrency in C# Cookbook

by Stephen Cleary
June 2014
Intermediate to advanced
208 pages
4h 21m
English
O'Reilly Media, Inc.
Content preview from Concurrency in C# Cookbook

Chapter 6. Testing

Testing is an essential part of software quality. Unit testing advocates in particular have become common in the last few years; it seems that you read or hear about it everywhere. Some promote test-driven development, which is a style of coding that ensures you have comprehensive tests when the application is complete. The benefits of unit testing on code quality and overall time to completion are well known, and yet (at the time of writing) most developers do not actually write unit tests.

I encourage you to write at least some unit tests, and start with the code where you feel the least confidence. In my personal experience, unit tests have given me two main advantages:

  1. Better understanding of the code. You know that part of the application that works but you have no idea how? It’s always kind of in the back of your mind when the really weird bug reports come in. Writing unit tests for the “hard” code is a great way to get a clear understanding of how it works. After writing unit tests describing its behavior, the code is no longer mysterious; you end up with a set of unit tests that describe its behavior as well as the dependencies that code has on the rest of the code.
  2. Greater confidence to make changes. Sooner or later, you’ll get that feature request that requires you to change the “scary” code, and you’ll no longer be able to pretend it isn’t there (I know how that feels; I’ve been there!). It’s best to be proactive: write the unit tests for the scary ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Concurrency in C# Cookbook, 2nd Edition

Concurrency in C# Cookbook, 2nd Edition

Stephen Cleary
Concurrency in .NET

Concurrency in .NET

Riccardo Terrell

Publisher Resources

ISBN: 9781491906675Errata Page