Click or drag to resize
TestUtilities Class
A collection of static methods that cover common aspects of testing objects.
Inheritance Hierarchy
SystemObject
  Test.FrameworkTestUtilities

Namespace: Test.Framework
Assembly: Test.Framework (in Test.Framework.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static class TestUtilities

The TestUtilities type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAssertIsAttribute
Throws an assertion if the type passed across is not sealed and is not based on Attribute.
Public methodStatic memberAssertIsException
Throws an assertion if the type passed across is not an exception type, does not have the correct constructors or is not serialisable.
Public methodStatic memberAssignPropertyValue
Assigns a constant dummy value to a property on an object.
Public methodStatic memberChangeType
Converts a value from one type to another, as per the standard ChangeType(Object, Type), except that this version can cope with the conversion of NullableT types.
Public methodStatic memberConvertBitStringToBytes
Converts a string of binary digits (with optional whitespace) to a collection of bytes.
Public methodStatic memberConvertToBitString(Int32, Int32)
Converts a value to a binary representation of a given length.
Public methodStatic memberConvertToBitString(Int64, Int32)
Converts a value to a binary representation of a given length.
Public methodStatic memberCreateMockImplementationT
Creates a Moq stub for an object and registers it with the class factory. The instance returned by the method is the one the code under test will always receive when it asks for an instantiation of the interface.
Public methodStatic memberCreateMockInstanceT
Creates a Moq stub for an object but does not register it with the class factory.
Public methodStatic memberCreateMockSingletonT
Public methodStatic memberSequenceEqualT
Returns true if both sequences are null or if the LINQ SequenceEqual method returns true for them, otherwise returns false.
Public methodStatic memberTestProperty(Object, String, Boolean)
Asserts that a bool property of an object has the given start value. Sets the property to the toggled start value and asserts that the toggled value can then be read back from the property.
Public methodStatic memberTestProperty(Object, String, Object, Object)
Asserts that a property of an object has a given start value and can be successfuly changed to another value.
Public methodStatic memberTestProperty(Object, String, Object, Object, Boolean)
Asserts that a property of an object has a given start value and can be successfuly changed to another value.
Public methodStatic memberTestPropertyT(T, ExpressionFuncT, Object, Boolean)
Asserts that a bool property of an object has the given start value. Sets the property to the toggled start value and asserts that the toggled value can then be read back from the property.
Public methodStatic memberTestPropertyT(T, ExpressionFuncT, Object, Object, Object)
Asserts that a property of an object has a given start value and can be successfuly changed to another value.
Public methodStatic memberTestPropertyT(T, ExpressionFuncT, Object, Object, Object, Boolean)
Asserts that the property passed across starts at a given value and can be changed to another value.
Public methodStatic memberTestSimpleEquals
Tests that an object whose Equals method tests all of its public properties is behaving correctly. Only works with objects that have a simple constructor.
Top
See Also