xunit Contains various static methods that are used to verify that conditions are met during the process of running tests. Initializes a new instance of the class. Verifies that a collection contains a given object. The type of the object to be verified The object expected to be in the collection The collection to be inspected Thrown when the object is not present in the collection Verifies that a collection contains a given object, using a comparer. The type of the object to be verified The object expected to be in the collection The collection to be inspected The comparer used to equate objects in the collection with the expected object Thrown when the object is not present in the collection Verifies that a string contains a given sub-string, using the current culture. The sub-string expected to be in the string The string to be inspected Thrown when the sub-string is not present inside the string Verifies that a string contains a given sub-string, using the given comparison type. The sub-string expected to be in the string The string to be inspected The type of string comparison to perform Thrown when the sub-string is not present inside the string Verifies that a collection does not contain a given object. The type of the object to be compared The object that is expected not to be in the collection The collection to be inspected Thrown when the object is present inside the container Verifies that a collection does not contain a given object, using a comparer. The type of the object to be compared The object that is expected not to be in the collection The collection to be inspected The comparer used to equate objects in the collection with the expected object Thrown when the object is present inside the container Verifies that a string does not contain a given sub-string, using the current culture. The sub-string which is expected not to be in the string The string to be inspected Thrown when the sub-string is present inside the string Verifies that a string does not contain a given sub-string, using the current culture. The sub-string which is expected not to be in the string The string to be inspected The type of string comparison to perform Thrown when the sub-string is present inside the given string Verifies that a block of code does not throw any exceptions. A delegate to the code to be tested Verifies that a collection is empty. The collection to be inspected Thrown when the collection is null Thrown when the collection is not empty Verifies that two objects are equal, using a default comparer. The type of the objects to be compared The expected value The value to be compared against Thrown when the objects are not equal Verifies that two objects are equal, using a custom comparer. The type of the objects to be compared The expected value The value to be compared against The comparer used to compare the two objects Thrown when the objects are not equal Do not call this method. Verifies that the condition is false. The condition to be tested Thrown if the condition is not false Verifies that the condition is false. The condition to be tested The message to show when the condition is not false Thrown if the condition is not false Verifies that a value is within a given range. The type of the value to be compared The actual value to be evaluated The (inclusive) low value of the range The (inclusive) high value of the range Thrown when the value is not in the given range Verifies that a value is within a given range, using a comparer. The type of the value to be compared The actual value to be evaluated The (inclusive) low value of the range The (inclusive) high value of the range The comparer used to evaluate the value's range Thrown when the value is not in the given range Verifies that an object is of the given type or a derived type. The type the object should be The object to be evaluated The object, casted to type T when successful Thrown when the object is not the given type Verifies that an object is of the given type or a derived type. The type the object should be The object to be evaluated Thrown when the object is not the given type Verifies that an object is not exactly the given type. The type the object should not be The object to be evaluated Thrown when the object is the given type Verifies that an object is not exactly the given type. The type the object should not be The object to be evaluated Thrown when the object is the given type Verifies that an object is exactly the given type (and not a derived type). The type the object should be The object to be evaluated The object, casted to type T when successful Thrown when the object is not the given type Verifies that an object is exactly the given type (and not a derived type). The type the object should be The object to be evaluated Thrown when the object is not the given type Verifies that a collection is not empty. The collection to be inspected Thrown when a null collection is passed Thrown when the collection is empty Verifies that two objects are not equal, using a default comparer. The type of the objects to be compared The expected object The actual object Thrown when the objects are equal Verifies that two objects are not equal, using a custom comparer. The type of the objects to be compared The expected object The actual object The comparer used to examine the objects Thrown when the objects are equal Verifies that a value is not within a given range, using the default comparer. The type of the value to be compared The actual value to be evaluated The (inclusive) low value of the range The (inclusive) high value of the range Thrown when the value is in the given range Verifies that a value is not within a given range, using a comparer. The type of the value to be compared The actual value to be evaluated The (inclusive) low value of the range The (inclusive) high value of the range The comparer used to evaluate the value's range Thrown when the value is in the given range Verifies that an object reference is not null. The object to be validated Thrown when the object is not null Verifies that two objects are not the same instance. The expected object instance The actual object instance Thrown when the objects are the same instance Verifies that an object reference is null. The object to be inspected Thrown when the object reference is not null Verifies that two objects are the same instance. The expected object instance The actual object instance Thrown when the objects are not the same instance Verifies that the exact exception is thrown (and not a derived exception type). The type of the exception expected to be thrown A delegate to the code to be tested The exception that was thrown, when successful Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown Verifies that the exact exception is thrown (and not a derived exception type). The type of the exception expected to be thrown The message to be shown if the test fails A delegate to the code to be tested The exception that was thrown, when successful Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown Verifies that the exact exception is thrown (and not a derived exception type). Generally used to test property accessors. The type of the exception expected to be thrown A delegate to the code to be tested The exception that was thrown, when successful Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown Verifies that the exact exception is thrown (and not a derived exception type). Generally used to test property accessors. The type of the exception expected to be thrown The message to be shown if the test fails A delegate to the code to be tested The exception that was thrown, when successful Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown Verifies that the exact exception is thrown (and not a derived exception type). The type of the exception expected to be thrown A delegate to the code to be tested The exception that was thrown, when successful Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown Verifies that the exact exception is thrown (and not a derived exception type). Generally used to test property accessors. The type of the exception expected to be thrown A delegate to the code to be tested The exception that was thrown, when successful Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown Verifies that an expression is true. The condition to be inspected Thrown when the condition is false Verifies that an expression is true. The condition to be inspected The message to be shown when the condition is false Thrown when the condition is false Used by the Throws and DoesNotThrow methods. Used by the Throws and DoesNotThrow methods. Captures standard output and standard error, and inserts the values into the as it traverses the chain. Base class used by commands which delegate to inner commands. Interface which represents the ability to invoke of a test method. Executes the test method. The instance of the test class Returns information about the test run Creates the start XML to be sent to the callback when the test is about to start running. Return the of the start node, or null if the test is known that it will not be running. Gets the display name of the test method. Determines if the test runner infrastructure should create a new instance of the test class before running the test. Creates a new instance of the class. The inner command to delegate to. Initializes a new instance of the class. The inner command Base class for exceptions that have actual and expected values The base assert exception class Initializes a new instance of the class. Initializes a new instance of the class. The user message to be displayed Initializes a new instance of the class. The user message to be displayed The inner exception Initializes a new instance of the class. The user message to be displayed The stack trace to be displayed Filters the stack trace to remove all lines that occur within the testing framework. The original stack trace The filtered stack trace Gets a string representation of the frames on the call stack at the time the current exception was thrown. A string that describes the contents of the call stack, with the most recent method call appearing first. Gets the user message Creates a new instance of the class. The expected value The actual value The user message to be shown Creates a new instance of the class. The expected value The actual value The user message to be shown Set to true to skip the check for difference position Gets the actual value. Gets the expected value. Gets a message that describes the current exception. Includes the expected and actual values. The error message that explains the reason for the exception, or an empty string(""). 1 Exception thrown when a collection unexpectedly does not contain the expected value. Creates a new instance of the class. The expected object value Exception to be thrown from when the number of parameter values does not the test method signature. Internal class used for version-resilient test runners. DO NOT CALL DIRECTLY. Version-resilient runners should link against xunit.runner.utility.dll and use ExecutorWrapper instead. Exception thrown when the value is unexpectedly not of the given type or a derived type. Creates a new instance of the class. The expected type The actual object value Allows the user to record actions for a test. Records any exception which is thrown by the given code. The code which may thrown an exception. Returns the exception that was thrown by the code; null, otherwise. Records any exception which is thrown by the given code that has a return value. Generally used for testing property accessors. The code which may thrown an exception. Returns the exception that was thrown by the code; null, otherwise. Exception that is thrown when one or more exceptions are thrown from the After method of a . Initializes a new instance of the class. The exceptions. Initializes a new instance of the class. The exceptions. Gets the list of exceptions thrown in the After method. Gets a message that describes the current exception. Gets a string representation of the frames on the call stack at the time the current exception was thrown. Implementation of which executes the instances attached to a test method. Initializes a new instance of the class. The inner command. The method. Executes the test method. The instance of the test class Returns information about the test run Wraps any exceptions thrown by the command execution. Initializes a new instance of the class. The inner command. The method. Executes the test method. The instance of the test class Returns information about the test run Guard class, used for guard clauses and argument validation Base class which contains XML manipulation helper methods Interface that represents a single test result. Converts the test result into XML that is consumed by the test runners. The parent node. The newly created XML node. The amount of time spent in execution Adds the test execution time to the XML node. The XML node. Utility methods for dealing with exceptions. Gets the message for the exception, including any inner exception messages. The exception The formatted message Gets the stack trace for the exception, including any inner exceptions. The exception The formatted stack trace Rethrows an exception object without losing the existing stack trace information The exception to re-throw. For more information on this technique, see http://www.dotnetjunkies.com/WebLog/chris.taylor/archive/2004/03/03/8353.aspx A dictionary which contains multiple unique values for each key. The type of the key. The type of the value. Adds the value for the given key. If the key does not exist in the dictionary yet, it will add it. The key. The value. Removes all keys and values from the dictionary. Determines whether the dictionary contains to specified key and value. The key. The value. Calls the delegate once for each key/value pair in the dictionary. Removes the given key and all of its values. Removes the given value from the given key. If this was the last value for the key, then the key is removed as well. The key. The value. Gets the values for the given key. Gets the count of the keys in the dictionary. Gets the keys. XML utility methods Adds an attribute to an XML node. The XML node. The attribute name. The attribute value. Adds a child element to an XML node. The parent XML node. The child element name. The new child XML element. Exception that is thrown when a call to Debug.Assert() fails. Creates a new instance of the class. The original assert message Creates a new instance of the class. The original assert message The original assert detailed message Gets the original assert detailed message. Gets the original assert message. Gets a message that describes the current exception. Exception thrown when a collection unexpectedly contains the expected value. Creates a new instance of the class. The expected object value Exception thrown when code unexpectedly throws an exception. Creates a new instance of the class. Actual exception Gets a string representation of the frames on the call stack at the time the current exception was thrown. A string that describes the contents of the call stack, with the most recent method call appearing first. Exception thrown when a collection is unexpectedly not empty. Creates a new instance of the class. Exception thrown when two values are unexpectedly not equal. Creates a new instance of the class. The expected object value The actual object value Exception thrown when a value is unexpectedly true. Creates a new instance of the class. The user message to be display, or null for the default message Exception thrown when a value is unexpectedly not in the given range. Creates a new instance of the class. The actual object value The low value of the range The high value of the range Gets the actual object value Gets the high value of the range Gets the low value of the range Gets a message that describes the current exception. The error message that explains the reason for the exception, or an empty string(""). Exception thrown when the value is unexpectedly of the exact given type. Creates a new instance of the class. The expected type The actual object value Exception thrown when the value is unexpectedly not of the exact given type. Creates a new instance of the class. The expected type The actual object value Used to decorate xUnit.net test classes that utilize fixture classes. An instance of the fixture data is initialized just before the first test in the class is run, and if it implements IDisposable, is disposed after the last test in the class is run. The type of the fixture Called on the test class just before each test method is run, passing the fixture data so that it can be used for the test. All test runs share the same instance of fixture data. The fixture data Exception thrown when a value is unexpectedly in the given range. Creates a new instance of the class. The actual object value The low value of the range The high value of the range Gets the actual object value Gets the high value of the range Gets the low value of the range Gets a message that describes the current exception. The error message that explains the reason for the exception, or an empty string(""). Base attribute which indicates a test method interception (allows code to be run before and after the test is run). This method is called after the test method is executed. The method under test This method is called before the test method is executed. The method under test Exception thrown when a collection is unexpectedly empty. Creates a new instance of the class. Exception thrown when two values are unexpectedly equal. Creates a new instance of the class. Exception thrown when an object is unexpectedly null. Creates a new instance of the class. Exception thrown when two values are unexpected the same instance. Creates a new instance of the class. Exception thrown when an object reference is unexpectedly not null. Creates a new instance of the class. Command that automatically creates the instance of the test class and disposes it (if it implements ). Creates a new instance of the object. The command that is bring wrapped The method under test Executes the test method. Creates a new instance of the class under tests and passes it to the inner command. Also catches any exceptions and converts them into s. The instance of the test class Returns information about the test run A command wrapper which catches Trace.Assert and Debug.Assert failures and turns them into assertion exceptions. Creates a new instance of the class. The command that will be wrapped. Executes the test method. The instance of the test class Returns information about the test run Command used to wrap a which has associated fixture data. Creates a new instance of the class. The inner command The fixtures to be set on the test class Sets the fixtures on the test class by calling SetFixture, then calls the inner command. The instance of the test class Returns information about the test run A timer class used to figure out how long tests take to run. On most .NET implementations this will use the class because it's a high resolution timer; however, on Silverlight/CoreCLR, it will use (which will provide lower resolution results). Creates a new instance of the class. Starts timing. Stops timing. Gets how long the timer ran, in milliseconds. In order for this to be valid, both and must have been called. Attribute used to decorate a test method with arbitrary name/value pairs ("traits"). Creates a new instance of the class. The trait name The trait value Gets the trait name. Gets the trait value. Runner that executes an synchronously. Execute the . The test class command to execute The methods to execute; if null or empty, all methods will be executed The start run callback The end run result callback A with the results of the test run Factory for objects, based on the type under test. Creates the test class command, which implements , for a given type. The type under test The test class command, if the class is a test class; null, otherwise Creates the test class command, which implements , for a given type. The type under test The test class command, if the class is a test class; null, otherwise Represents an xUnit.net test class Interface which describes the ability to executes all the tests in a test class. Allows the test class command to choose the next test to be run from the list of tests that have not yet been run, thereby allowing it to choose the run order. The tests remaining to be run The index of the test that should be run Execute actions to be run after all the test methods of this test class are run. Returns the thrown during execution, if any; null, otherwise Execute actions to be run before any of the test methods of this test class are run. Returns the thrown during execution, if any; null, otherwise Enumerates the test commands for a given test method in this test class. The method under test The test commands for the given test method Enumerates the methods which are test methods in this test class. The test methods Determines if a given refers to a test method. The test method to validate True if the method is a test method; false, otherwise Gets the object instance that is under test. May return null if you wish the test framework to create a new object instance for each test method. Gets or sets the type that is being tested Creates a new instance of the class. Creates a new instance of the class. The type under test Creates a new instance of the class. The type under test Chooses the next test to run, randomly, using the . The tests remaining to be run The index of the test that should be run Execute actions to be run after all the test methods of this test class are run. Returns the thrown during execution, if any; null, otherwise Execute actions to be run before any of the test methods of this test class are run. Returns the thrown during execution, if any; null, otherwise Enumerates the test commands for a given test method in this test class. The method under test The test commands for the given test method Enumerates the methods which are test methods in this test class. The test methods Determines if a given refers to a test method. The test method to validate True if the method is a test method; false, otherwise Gets the object instance that is under test. May return null if you wish the test framework to create a new object instance for each test method. Gets or sets the randomizer used to determine the order in which tests are run. Sets the type that is being tested Implementation of that represents a skipped test. Represents an xUnit.net test command. The method under test. Initializes a new instance of the class. The method under test. Initializes a new instance of the class. The method under test. The display name of the test. Gets the name of the method under test. Gets the name of the type under test. Creates a new instance of the class. The method that is being skipped The display name for the test. If null, the fully qualified type name is used. The reason the test was skipped. Gets the skip reason. Factory for creating objects. Make instances of objects for the given class and method. The class command The method under test The set of objects A command wrapper which times the running of a command. Creates a new instance of the class. The command that will be timed. Executes the inner test method, gathering the amount of time it takes to run. Returns information about the test run Wraps a command which should fail if it runs longer than the given timeout value. Creates a new instance of the class. The command to be run The timout, in milliseconds The method under test Executes the test method, failing if it takes too long. Returns information about the test run Gets the timeout value, in milliseconds. Attributes used to decorate a test fixture that is run with an alternate test runner. The test runner must implement the interface. Creates a new instance of the class. The class which implements ITestClassCommand and acts as the runner for the test fixture. Gets the test class command. Exception thrown when two object references are unexpectedly not the same instance. Creates a new instance of the class. The expected object reference The actual object reference Contains the test results from an assembly. Contains multiple test results, representing them as a composite test result. Adds a test result to the composite test result list. Gets the test results. Creates a new instance of the class. The filename of the assembly Creates a new instance of the class. The filename of the assembly The configuration filename Converts the test result into XML that is consumed by the test runners. The parent node. The newly created XML node. Gets the fully qualified filename of the configuration file. Gets the directory where the assembly resides. Gets the number of failed results. Gets the fully qualified filename of the assembly. Gets the number of passed results. Gets the number of skipped results. Contains the test results from a test class. Creates a new instance of the class. The type under test Creates a new instance of the class. The simple name of the type under test The fully qualified name of the type under test The namespace of the type under test Sets the exception thrown by the test fixture. The thrown exception Converts the test result into XML that is consumed by the test runners. The parent node. The newly created XML node. Gets the fully qualified test fixture exception type, when an exception has occurred. Gets the number of tests which failed. Gets the fully qualified name of the type under test. Gets the test fixture exception message, when an exception has occurred. Gets the simple name of the type under test. Gets the namespace of the type under test. Gets the number of tests which passed. Gets the number of tests which were skipped. Gets the test fixture exception stack trace, when an exception has occurred. Represents a failed test result. Represents the results from running a test method Initializes a new instance of the class. The traits for the test method are discovered using reflection. The method under test. The display name for the test. If null, the fully qualified type name is used. Initializes a new instance of the class. The name of the method under test. The type of the method under test. The display name for the test. If null, the fully qualified type name is used. The traits. Converts the test result into XML that is consumed by the test runners. The parent node. The newly created XML node. Gets or sets the display name of the method under test. This is the value that's shown during failures and in the resulting output XML. Gets the name of the method under test. Gets or sets the standard output/standard error from the test that was captured while the test was running. Gets the traits attached to the test method. Gets the name of the type under test. Creates a new instance of the class. The method under test The exception throw by the test The display name for the test. If null, the fully qualified type name is used. Creates a new instance of the class. The name of the method under test The name of the type under test The display name of the test The custom properties attached to the test method The full type name of the exception throw The exception message The exception stack trace Converts the test result into XML that is consumed by the test runners. The parent node. The newly created XML node. Gets the exception type thrown by the test method. Gets the exception message thrown by the test method. Gets the stack trace of the exception thrown by the test method. Represents a passing test result. Create a new instance of the class. The method under test The display name for the test. If null, the fully qualified type name is used. Create a new instance of the class. The name of the method under test The name of the type under test The display name for the test. If null, the fully qualified type name is used. The custom properties attached to the test method Converts the test result into XML that is consumed by the test runners. The parent node. The newly created XML node. Represents a skipped test result. Creates a new instance of the class. Uses reflection to discover the skip reason. The method under test The display name for the test. If null, the fully qualified type name is used. The reason the test was skipped. Creates a new instance of the class. The name of the method under test The name of the type under test The display name for the test. If null, the fully qualified type name is used. The traits attached to the method under test The skip reason Converts the test result into XML that is consumed by the test runners. The parent node. The newly created XML node. Gets the skip reason. Represents information about an attribute. Gets the instance of the attribute, if available. The type of the attribute The instance of the attribute, if available. Gets an initialized property value of the attribute. The type of the property The name of the property The property value Represents information about a method. Creates an instance of the type where this test method was found. If using reflection, this should be the ReflectedType. A new instance of the type. Gets all the custom attributes for the method that are of the given type. The type of the attribute The matching attributes that decorate the method Determines if the method has at least one instance of the given attribute type. The type of the attribute True if the method has at least one instance of the given attribute type; false, otherwise Invokes the test on the given class, with the given parameters. The instance of the test class (may be null if the test method is static). The parameters to be passed to the test method. Gets a value indicating whether the method is abstract. Gets a value indicating whether the method is static. Gets the underlying for the method, if available. Gets the name of the method. Gets the fully qualified type name of the return type. Gets the fully qualified type name of the type that this method belongs to. If using reflection, this should be the ReflectedType. Represents information about a type. Gets all the custom attributes for the type that are of the given attribute type. The type of the attribute The matching attributes that decorate the type Gets a test method by name. The name of the method The method, if it exists; null, otherwise. Gets all the methods Determines if the type has at least one instance of the given attribute type. The type of the attribute True if the type has at least one instance of the given attribute type; false, otherwise Determines if the type implements the given interface. The type of the interface True if the type implements the given interface; false, otherwise Gets a value indicating whether the type is abstract. Gets a value indicating whether the type is sealed. Gets the underlying object, if available. Utility class which inspects methods for test information Gets the skip reason from a test method. The method to be inspected The skip reason Gets the test commands for a test method. The method to be inspected The objects for the test method Gets the timeout value for a test method. The method to be inspected The timeout, in milliseconds Gets the traits on a test method. The method to be inspected A dictionary of the traits Determines whether a test method has a timeout. The method to be inspected True if the method has a timeout; false, otherwise Determines whether a test method has traits. The method to be inspected True if the method has traits; false, otherwise Determines whether a test method should be skipped. The method to be inspected True if the method should be skipped; false, otherwise Determines whether a method is a test method. A test method must be decorated with the (or derived class) and must not be abstract. The method to be inspected True if the method is a test method; false, otherwise Wrapper to implement and using reflection. Converts an into an using reflection. Converts a into an using reflection. The method to wrap The wrapper Converts a into an using reflection. The type to wrap The wrapper Utility class which inspects types for test information Determines if a type contains any test methods The type to be inspected True if the class contains any test methods; false, otherwise Retrieves the type to run the test class with from the , if present. The type to be inspected The type of the test class runner, if present; null, otherwise Retrieves a list of the test methods from the test class. The type to be inspected The test methods Determines if the test class has a applied to it. The type to be inspected True if the test class has a run with attribute; false, otherwise Determines if the type implements . The type to be inspected True if the type implements ; false, otherwise Determines whether the specified type is abstract. The type. true if the specified type is abstract; otherwise, false. Determines whether the specified type is static. The type. true if the specified type is static; otherwise, false. Determines if a class is a test class. The type to be inspected True if the type is a test class; false, otherwise Attribute that is applied to a method to indicate that it is a fact that should be run by the test runner. It can also be extended to support a customized definition of a test method. Creates instances of which represent individual intended invocations of the test method. The method under test An enumerator through the desired test method invocations Enumerates the test commands represented by this test method. Derived classes should override this method to return instances of , one per execution of a test method. The test method The test commands which will execute the test runs for the given method Gets the name of the test to be used when the test is skipped. Defaults to null, which will cause the fully qualified test name to be used. Obsolete. Please use the property instead. Marks the test so that it will not be run, and gets or sets the skip reason Marks the test as failing if it does not finish running within the given time period, in milliseconds; set to 0 or less to indicate the method has no timeout Exception thrown when code unexpectedly fails to throw an exception. Creates a new instance of the class. Call this constructor when no exception was thrown. The type of the exception that was expected Creates a new instance of the class. Call this constructor when an exception of the wrong type was thrown. The type of the exception that was expected The actual exception that was thrown Gets a string representation of the frames on the call stack at the time the current exception was thrown. A string that describes the contents of the call stack, with the most recent method call appearing first. Exception thrown when a test method exceeds the given timeout value Creates a new instance of the class. The timeout value, in milliseconds Exception thrown when a value is unexpectedly false. Creates a new instance of the class. The user message to be displayed, or null for the default message