This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

<< Previous | 1 | 2 | 3 | 4 | Next >> |
NUnit File AssertionsNUnit File Assertions
Nunit has several types of assertion that can be used in addition to the basic methods provided by the Assert class. One set of assertions, included in the FileAssert class, allows the contents of files to be compared.
NUnit Directory AssertionsNUnit Directory Assertions
NUnit includes several assertion classes in addition to the commonly used, Assert class. One is the DirectoryAssert type, which contains methods that validate the equality of folder paths, confirm folder structures are as expected and verify the contents of directories.
Using Callbacks with MoqUsing Callbacks with Moq
Some scenarios are difficult to test when using mocks with simple expectations. When the functionality of a dependency is complex, it can be useful to inject callback code that is executed when the mock object is accessed.
NUnit String AssertionsNUnit String Assertions
The assertions provided by the NUnit framework's Assert class are sufficient to test any code. However, NUnit does provide other assertion classes, which can make tests more readable. Once such class includes assertions for strings.
NUnit Collection AssertionsNUnit Collection Assertions
The basic assertions provided by the NUnit framework can be used for all unit tests. To make unit tests more readable, there are other assertion types that more clearly express the intent of the tests. This article describes the collection assertions.
Mocking Static and Sealed Types Using WrappersMocking Static and Sealed Types Using Wrappers
A key concept in unit testing is isolating the code under test from its dependencies. However, when those dependencies are static or sealed types, creating appropriate test doubles, such as stubs or mocks, becomes more difficult.
A Single-Pass Sequence for TestingA Single-Pass Sequence for Testing
When writing unit tests for methods that operate upon IEnumerable<T> sequences, it is easy to overlook the behaviour for sequences that can only be enumerated once. This article describes a helper class for such tests that provides a one pass collection.
Mocking Multiple Interfaces with MoqMocking Multiple Interfaces with Moq
Injected dependencies often implement more than one interface. These may be used by the class receiving the injected object. When testing classes with such dependencies, it can be useful to create mock objects that implement multiple interfaces.
Creating Custom NUnit Assertion MethodsCreating Custom NUnit Assertion Methods
NUnit provides a large number of assertion methods that can test values for correctness during a test run. For complex and repetitive test scenarios, it can be useful to create custom assertions that can be reused in a number of tests.
Moq Partial MocksMoq Partial Mocks
Moq is commonly used to create mock objects based upon interfaces. However, it can also be used to mock classes. This includes the possibility of creating partial mocks, where some members are intercepted with expectations whilst others run as normal.
<< Previous | 1 | 2 | 3 | 4 | Next >> |