Book Image

ASP.NET Core 2 Fundamentals

By : Onur Gumus, Mugilan T. S. Ragupathi
Book Image

ASP.NET Core 2 Fundamentals

By: Onur Gumus, Mugilan T. S. Ragupathi

Overview of this book

The book sets the stage with an introduction to web applications and helps you build an understanding of the tried-and-true MVC architecture. You learn all about views, from what is the Razor view engine to tagging helpers. You gain insight into what models are, how to bind them, and how to migrate database using the correct model. As you get comfortable with the world of ASP.NET, you learn about validation and routing. You also learn the advanced concepts, such as designing Rest Buy (a RESTful shopping cart application), creating entities for it, and creating EF context and migrations. By the time you are done reading the book, you will be able to optimally use ASP.NET to develop, unit test, and deploy applications like a pro.
Table of Contents (14 chapters)

Creating a Unit Test


In the last decade unit tests have become popular. But many times, the true goal of unit tests are not well understood, perhaps due to the naming. It's true that unit tests are very helpful in terms of finding bugs in our software.

It is useful to write unit test even if you have a function with a small amount of code. The reason is although unit tests are for hunting bugs there is one category of bugs they are primarily helpful for finding. That is regression. Regression usually happens through the breakage of existing functionality as we add new code.

With regard to regression, a unit tests acts like a fusebox. It will ensure that if we break existing functionality without realising, the older tests start to fail. And if they don't, the programmer will feel comfortable as he or she would know that it is unlikely that existing functionality is broken. Although unit tests do not guarantee this kind of safety, it is an invaluable asset if you constantly add to or change...