Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Improving your C# Skills

You're reading from   Improving your C# Skills Solve modern challenges with functional programming and test-driven techniques of C#

Arrow left icon
Product type Course
Published in Feb 2019
Publisher
ISBN-13 9781838558383
Length 606 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Ovais Mehboob Ahmed Khan Ovais Mehboob Ahmed Khan
Author Profile Icon Ovais Mehboob Ahmed Khan
Ovais Mehboob Ahmed Khan
Clayton Hunt Clayton Hunt
Author Profile Icon Clayton Hunt
Clayton Hunt
John Callaway John Callaway
Author Profile Icon John Callaway
John Callaway
Rod Stephens Rod Stephens
Author Profile Icon Rod Stephens
Rod Stephens
Arrow right icon
View More author details
Toc

Table of Contents (26) Chapters Close

Title Page
Copyright and Credits
About Packt
Contributors
Preface
1. What's New in .NET Core 2 and C# 7? FREE CHAPTER 2. Understanding .NET Core Internals and Measuring Performance 3. Multithreading and Asynchronous Programming in .NET Core 4. Securing and Implementing Resilience in .NET Core Applications 5. Why TDD is Important 6. Setting Up the .NET Test Environment 7. Setting Up a JavaScript Environment 8. What to Know Before Getting Started 9. Tabula Rasa – Approaching an Application with TDD in Mind 10. Testing JavaScript Applications 11. Exploring Integrations 12. Changes in Requirements 13. The Legacy Problem 14. Unraveling a Mess 15. Geometry 16. Randomization 17. Files and Directories 18. Advanced C# and .NET Features 19. Cryptography 1. Other Books You May Enjoy Index

Hello World


Stepping back to one of our first examples, take a look at the sample Hello World application. Remember that, depending on the time of day, a different message is displayed to the user. Before noon, the user is greeted with Good morning, and after noon, Good afternoon is returned to the user.

A change in requirements

Depending on the time of day, the user is greeted with Good morning or Good afternoon. To extend the functionality and introduce a new feature, let's address the user with Good evening if the time of day is between 6 p.m. and midnight.

Good evening 

In order to introduce this new feature, begin with the tests. Modification of an existing test will be needed, as well as adding one or more new tests to cover the change in requirements.

Modify the Theory data provided to GivenAfternoon_ThenAfternoonMessage so that only noon through 6 p.m. are included for this test. Now, create a new test method, GivenEvening_ThenEveningMessage:

[Theory]
[InlineData(19)]
[InlineData(20)]...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image