Skip to content

Commit

Permalink
Add unit test guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
aodendaal committed Nov 20, 2019
1 parent 7b01dcc commit 30eeaac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ While not a requisite (since we're coving most of it in depth in this tutorial)
* [What is the 'clearfix' class for?](docs/clearfix.md)
* [ExpressionChangedAfterItHasBeenCheckedError](https://blog.angular-university.io/angular-debugging/)

## Other Articles
* [Unit Testing](docs/unittesting.md)

## AppFactory Customizations
* [Entity Not Found Exception](https://gist.github.com/aodendaal/86fedc36b3593a4adbd4e35ef0327702)
* [Angular 2 User Profile Self-Help Editor](https://github.com/aodendaal/abp-ng2-profile-editor)
Expand Down
14 changes: 14 additions & 0 deletions docs/unittesting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Unit Testing

## Guidelines
The AAA (Arrange, Act, Assert) pattern is a common way of writing unit tests for a method under test.

* The **Arrange** section of a unit test method initializes objects and sets the value of the data that is passed to the method under test.
* The **Act** section invokes the method under test with the arranged parameters.
* The **Assert** section verifies that the action of the method under test behaves as expected.

Taken from https://docs.microsoft.com/en-us/visualstudio/test/unit-test-basics?view=vs-2019

If you are finding you need to test a lot of private behavior, most likely you have a new 'class' hiding within the class you are trying to test, extract it and test it by its public interface.

Taken from https://stackoverflow.com/questions/9122708/unit-testing-private-methods-in-c-sharp

0 comments on commit 30eeaac

Please sign in to comment.