Details

Title: C# and .NET Core test-driven development: dive into TDD to create flexible, maintainable, and production-ready .NET Core applications
Creators: Adewole Ayobami
Collection: Электронные книги зарубежных издательств; Общая коллекция
Subjects: C# (Computer program language); Application software — Development.; Internet programming.; COMPUTERS / Programming Languages / C#.; COMPUTERS / Internet / Application Development.; EBSCO eBooks
Document type: Other
File type: PDF
Language: English
Rights: Доступ по паролю из сети Интернет (чтение, печать, копирование)
Record key: on1040599397

Allowed Actions:

pdf/1817502.pdf
Action 'Read' will be available if you login or access site from another network Action 'Download' will be available if you login or access site from another network
epub/1817502.epub
Action 'Download' will be available if you login or access site from another network

Group: Anonymous

Network: Internet

Annotation

Annotation. Learn how to apply a test-driven development process by building ready C# 7 and .NET Core applications.Key Features 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 codeBook DescriptionThis 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.What you will learnWrite flexible, maintainable, and verifiable code for .NET CoreWrite testable code using SOLID principles and dependency injectionsRecognize the characteristics of a good unit testStructure and group your unit testUse mock objects to handle dependenciesSet up an end-to-end continuous integration process Who this book is forThis 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.

Document access rights

Network User group Action
ILC SPbPU Local Network All Read Print Download
Internet Authorized users SPbPU Read Print Download
-> Internet Anonymous

Table of Contents

  • Cover
  • Copyright and Credits
  • Dedication
  • Packt Upsell
  • Contributors
  • Table of Contents
  • Preface
  • Chapter 1: Exploring Test-Driven Development
    • Difficulty in maintaining code
    • How does bad code appear? 
      • Tight coupling
      • Code smell
      • Bad or broken designs
      • Naming the program elements
      • Source code readability
      • Poor source code documentation
      • Non-tested code
    • What we can do to prevent bad code
      • Loose coupling
      • Sound architecture and design
      • Preventing and detecting code smell
      • C# coding conventions
      • Succinct and proper documentation
      • Why test-driven development?
      • Building for longevity
    • The principles of test-driven development
      • Origin of TDD
      • TDD misconceptions
      • Benefits of TDD
      • Types of tests
        • Unit tests
        • Integration tests
        • System testing
        • User acceptance testing
      • Principles of TDD
        • Writing the tests
        • Writing the code
        • Running the tests
        • Refactoring
      • Doing TDD the wrong way
    • The TDD cycle
    • Summary
  • Chapter 2: Getting Started with .NET Core
    • .NET Core framework
      • .NET Standard
      • .NET Core components
      • Supported languages
      • When to choose .NET Core over .NET Framework
        • Cross-platform requirements
        • Ease of deployment
        • Scalability and performance
      • Limitations of .NET Core
    • Structure of a .NET Core application
      • ASP.NET Core MVC project structure
        • wwwroot folder
        • Models, Views, and Controllers folders
        • JSON files – bower.json, appsettings.json, bundleconfig.json
        • Program.cs
        • Startup.cs
    • Tour of Microsoft's Visual Studio Code editor
      • Installing .NET Core on Linux
      • Installing and setting up Visual Studio Code on Linux
      • Exploring Visual Studio Code
    • A look at the new features of C# 7
      • Tuples enhancement
      • Out keyword
      • Ref locals and returns
        • Ref locals
        • Ref returns
      • Local function
      • Patterns matching
      • Digit separator and binary literal
    • Creating an ASP.NET MVC Core application
    • Summary
  • Chapter 3: Writing Testable Code
    • Warning signs when writing untestable code
      • Tight coupling
      • Monster Constructor
      • Classes with more than one responsibility
      • Static objects
    • Law of Demeter
      • Train Wreck
    • The SOLID architecture principles
      • Single Responsibility Principle
      • Open-Closed Principle 
      • Liskov Substitution Principle
      • Interface Segregation Principle
      • Dependency Inversion Principle
    • Setting up a DI container for ASP.NET Core MVC
    • Summary
  • Chapter 4: .NET Core Unit Testing
    • The attributes of a good unit test
      • Readable
      • Unit independence
      • Repeatable
      • Maintainable and runs fast
      • Easy to set up, non-trivial, and with good coverage
    • Unit testing framework ecosystem for .NET Core and C#
      • .NET Core testing with MSTest
      • .NET Core testing with NUnit
      • xUnit.net
        • How to configure xUnit.net
        • xUnit.net test runners
        • Test parallelism
    • Unit testing consideration for ASP.NET MVC Core
      • Unit testing controllers
      • Unit testing razor pages
    • Structuring unit tests with xUnit
    • xUnit.net shared test context
    • Live unit testing with Visual Studio 2017 Enterprise
    • Proving unit test results with xUnit.net assertions
    • The test runners available on both .NET Core and Windows
      • ReSharper
    • Summary
  • Chapter 5: Data-Driven Unit Tests
    • The benefits of data-driven unit testing
      • Tests brevity
      • Inclusive testing
    • xUnit.net theory attribute for creating data-driven tests
    • Inline data-driven unit tests
    • Property data-driven unit tests
      • MemberData attribute
      • ClassData attribute
    • Integrating data from other sources
      • SqlServerData attribute
      • Custom attribute
    • Summary
  • Chapter 6: Mocking Dependencies
    • The benefits of mocking objects
      • Fast running tests
      • Dependencies isolation
      • Refactoring legacy code
      • Wider test coverage
    • The shortcomings of mocking frameworks
      • Interface explosion
      • Extra complexity
      • Mock explosion
    • Hand-rolling mocks versus using a mocking framework
      • Mocking concept
      • Benefits of hand-rolling mocks
      • Mocks and stubs
      • Hand-rolled mock
    • Mocking objects using Moq framework
      • Mocking methods, properties, and callback
        • Properties
        • Matching parameters
        • Events
        • Callbacks
        • Mock customization
          • CallBase
          • Mock repository
          • Implementing multiple interfaces in a mock
      • Verification method and property invocations with Moq
      • LINQ to mocks
      • Advanced Moq features
        • Mocking internal types
    • Summary
  • Chapter 7: Continuous Integration and Project Hosting
    • Continuous integration
      • CI workflow
        • Single source code repository
        • Build automation
        • Automated tests
        • Identical test and production environments
        • Daily commit
      • Benefits of CI
        • Quick bugs detection
        • Improved productivity
        • Reduced risks
        • Facilitating continuous delivery
      • CI tools
        • Microsoft Team Foundation Server
        • TeamCity
        • Jenkins
    • Continuous delivery
      • Benefits of continuous delivery
        • Lower risks
        • Quality software products
        • Reduced costs
    • GitHub online project hosting
      • Project hosting
        • Branching with GitHub Flow
          • Pull request
          • Reviewing changes and merging
    • Basic Git commands
      • Configuration commands
      • Initializing repository commands
      • Change commands
      • Branching and merging commands
    • Configuring GitHub WebHooks
      • Consuming WebHooks
      • GitHub WebHook
        • Events and payloads
        • Setting up your first WebHook
    • TeamCity CI platform
      • TeamCity concepts
      • Installing TeamCity Server
      • TeamCity CI workflow
      • Configuring and running build
    • Summary
  • Chapter 8: Creating Continuous Integration Build Processes
    • Installing the Cake Bootstrapper
      • Installation
        • PowerShell security
        • Cake Bootstrapper installation steps
          • Step 1
          • Step 2
          • Step 3
    • Writing build scripts in C#
      • Task
      • TaskSetup and TaskTeardown
      • Configuration and preprocessor directives
      • Dependencies
      • Criteria
      • Cake's error handling and finally block
      • LoanApplication build script
    • Cake Extension for Visual Studio
      • Cake templates
      • Task Runner Explorer
      • Syntax highlighting
    • Using Cake tasks to build steps
    • CI with Visual Studio Team Services
      • Setting up a project in VSTS
      • Installing Cake into VSTS
      • Adding a build task
    • Summary
  • Testing and Chapter 9: Packaging the Application
    • Executing xUnit.net tests with Cake
      • Executing xUnit.net tests in .NET projects
      • Executing xUnit.net tests in .NET Core projects
    • .NET Core versioning
      • Versioning principle
      • Installer
      • Package manager
      • Docker
      • Semantic Versioning
    • .NET Core packages and metapackages
      • Metapackage
      • Microsoft.AspNetCore.All metapackage
    • Packaging for NuGet distribution
      • dotnet publish command
      • Creating a NuGet package
    • Summary
  • Other Books You May Enjoy
  • Index

Usage statistics

pdf/1817502.pdf

stat Access count: 0
Last 30 days: 0
Detailed usage statistics

epub/1817502.epub

stat Access count: 0
Last 30 days: 0
Detailed usage statistics