C# Note36: .NET unit testing framework

It’s usually good practice to have automated unit tests while developing your code. Doing so helps you find bugs early in the development cycle and saves you time in the long run. These tests can be run by the developer multiple times to verify the behavior of a particular unit of code for different sets of input.
Unit tests essentially check the behavior of a particular unit of the code or the function and are written by the developers who are implementing the functionalities.
We test the behavior of a function before it becomes part of the whole system and goes into production by writing a piece of code to test this behavior under different conditions. Usually, a function gets tested in isolation with the other functions of the system under test (SUT).
In .NET, there are two options to write Unit Tests:
1. Using MS Test
2. Using NUnit
3. Using XUnit  

In the article "Getting started with .NET unit testing using NUnit", you can learn to start Unit testing of C# classes using NUnit. This article will walk through:

  • Creating the system under test
  • Setting up NUnit
  • Creating the Test project
  • Creating Test classes and methods
  • Different options for running the tests
  • Understanding TestFixtures and TestTearDown
  • Working with Ignore test
 
 
 
 
 

转载于:https://www.cnblogs.com/carsonzhu/p/8601999.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值