Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
swdev:dotnet:unit_testing_with_nunit [2016/06/30 15:36] smayr [Run Tests] |
swdev:dotnet:unit_testing_with_nunit [2016/06/30 15:38] (current) smayr [Pattern AAA] |
||
---|---|---|---|
Line 66: | Line 66: | ||
== Pattern AAA == | == Pattern AAA == | ||
Modern tests contain three parts: | Modern tests contain three parts: | ||
+ | <code csharp> | ||
[TestMethod] | [TestMethod] | ||
public void GetCount_ItemCountIsZero_NoNewMessages() | public void GetCount_ItemCountIsZero_NoNewMessages() | ||
Line 78: | Line 79: | ||
Assert.AreEqual(" | Assert.AreEqual(" | ||
} | } | ||
+ | </ | ||
+ | This can be summed up as a pattern: | ||
* Arrange: setup everything needed for the running the tested code. This includes any initialization of dependencies, | * Arrange: setup everything needed for the running the tested code. This includes any initialization of dependencies, | ||
* Act: Invoke the code under test. | * Act: Invoke the code under test. | ||
* Assert: Specify the pass criteria for the test, which fails it if not met. | * Assert: Specify the pass criteria for the test, which fails it if not met. | ||
+ | |||
+ | Source: [[http:// |