Table of Contents

Class FileAssert

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

Asserts on Files

public static class FileAssert
Inheritance
FileAssert
Inherited Members

Methods

AreEqual(FileInfo, FileInfo)

Verifies that two files are equal. Two files are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(FileInfo expected, FileInfo actual)

Parameters

expected FileInfo

A file containing the value that is expected

actual FileInfo

A file containing the actual value

AreEqual(FileInfo, FileInfo, string)

Verifies that two files are equal. Two files are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(FileInfo expected, FileInfo actual, string message)

Parameters

expected FileInfo

A file containing the value that is expected

actual FileInfo

A file containing the actual value

message string

The message to display if objects are not equal

AreEqual(FileInfo, FileInfo, string, params object[])

Verifies that two files are equal. Two files are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(FileInfo expected, FileInfo actual, string message, params object[] args)

Parameters

expected FileInfo

A file containing the value that is expected

actual FileInfo

A file containing the actual value

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

AreEqual(Stream, Stream)

Verifies that two Streams are equal. Two Streams are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(Stream expected, Stream actual)

Parameters

expected Stream

The expected Stream

actual Stream

The actual Stream

AreEqual(Stream, Stream, string)

Verifies that two Streams are equal. Two Streams are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(Stream expected, Stream actual, string message)

Parameters

expected Stream

The expected Stream

actual Stream

The actual Stream

message string

The message to display if objects are not equal

AreEqual(Stream, Stream, string, params object[])

Verifies that two Streams are equal. Two Streams are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(Stream expected, Stream actual, string message, params object[] args)

Parameters

expected Stream

The expected Stream

actual Stream

The actual Stream

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

AreEqual(string, string)

Verifies that two files are equal. Two files are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(string expected, string actual)

Parameters

expected string

The path to a file containing the value that is expected

actual string

The path to a file containing the actual value

AreEqual(string, string, string)

Verifies that two files are equal. Two files are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(string expected, string actual, string message)

Parameters

expected string

The path to a file containing the value that is expected

actual string

The path to a file containing the actual value

message string

The message to display if objects are not equal

AreEqual(string, string, string, params object[])

Verifies that two files are equal. Two files are considered equal if both are null, or if both have the same value byte for byte. If they are not equal an AssertionException is thrown.

public static void AreEqual(string expected, string actual, string message, params object[] args)

Parameters

expected string

The path to a file containing the value that is expected

actual string

The path to a file containing the actual value

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

AreNotEqual(FileInfo, FileInfo)

Asserts that two files are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(FileInfo expected, FileInfo actual)

Parameters

expected FileInfo

A file containing the value that is expected

actual FileInfo

A file containing the actual value

AreNotEqual(FileInfo, FileInfo, string)

Asserts that two files are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(FileInfo expected, FileInfo actual, string message)

Parameters

expected FileInfo

A file containing the value that is expected

actual FileInfo

A file containing the actual value

message string

The message to display if objects are not equal

AreNotEqual(FileInfo, FileInfo, string, params object[])

Asserts that two files are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(FileInfo expected, FileInfo actual, string message, params object[] args)

Parameters

expected FileInfo

A file containing the value that is expected

actual FileInfo

A file containing the actual value

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

AreNotEqual(Stream, Stream)

Asserts that two Streams are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(Stream expected, Stream actual)

Parameters

expected Stream

The expected Stream

actual Stream

The actual Stream

AreNotEqual(Stream, Stream, string)

Asserts that two Streams are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(Stream expected, Stream actual, string message)

Parameters

expected Stream

The expected Stream

actual Stream

The actual Stream

message string

The message to be displayed when the Streams are the same.

AreNotEqual(Stream, Stream, string, params object[])

Asserts that two Streams are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(Stream expected, Stream actual, string message, params object[] args)

Parameters

expected Stream

The expected Stream

actual Stream

The actual Stream

message string

The message to be displayed when the two Stream are the same.

args object[]

Arguments to be used in formatting the message

AreNotEqual(string, string)

Asserts that two files are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(string expected, string actual)

Parameters

expected string

The path to a file containing the value that is expected

actual string

The path to a file containing the actual value

AreNotEqual(string, string, string)

Asserts that two files are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(string expected, string actual, string message)

Parameters

expected string

The path to a file containing the value that is expected

actual string

The path to a file containing the actual value

message string

The message to display if objects are not equal

AreNotEqual(string, string, string, params object[])

Asserts that two files are not equal. If they are equal an AssertionException is thrown.

public static void AreNotEqual(string expected, string actual, string message, params object[] args)

Parameters

expected string

The path to a file containing the value that is expected

actual string

The path to a file containing the actual value

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

DoesNotExist(FileInfo)

Asserts that the file does not exist. If it does exist an AssertionException is thrown.

public static void DoesNotExist(FileInfo actual)

Parameters

actual FileInfo

A file containing the actual value

DoesNotExist(FileInfo, string)

Asserts that the file does not exist. If it does exist an AssertionException is thrown.

public static void DoesNotExist(FileInfo actual, string message)

Parameters

actual FileInfo

A file containing the actual value

message string

The message to display if objects are not equal

DoesNotExist(FileInfo, string, params object[])

Asserts that the file does not exist. If it does exist an AssertionException is thrown.

public static void DoesNotExist(FileInfo actual, string message, params object[] args)

Parameters

actual FileInfo

A file containing the actual value

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

DoesNotExist(string)

Asserts that the file does not exist. If it does exist an AssertionException is thrown.

public static void DoesNotExist(string actual)

Parameters

actual string

The path to a file containing the actual value

DoesNotExist(string, string)

Asserts that the file does not exist. If it does exist an AssertionException is thrown.

public static void DoesNotExist(string actual, string message)

Parameters

actual string

The path to a file containing the actual value

message string

The message to display if objects are not equal

DoesNotExist(string, string, params object[])

Asserts that the file does not exist. If it does exist an AssertionException is thrown.

public static void DoesNotExist(string actual, string message, params object[] args)

Parameters

actual string

The path to a file containing the actual value

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

Exists(FileInfo)

Asserts that the file exists. If it does not exist an AssertionException is thrown.

public static void Exists(FileInfo actual)

Parameters

actual FileInfo

A file containing the actual value

Exists(FileInfo, string)

Asserts that the file exists. If it does not exist an AssertionException is thrown.

public static void Exists(FileInfo actual, string message)

Parameters

actual FileInfo

A file containing the actual value

message string

The message to display if objects are not equal

Exists(FileInfo, string, params object[])

Asserts that the file exists. If it does not exist an AssertionException is thrown.

public static void Exists(FileInfo actual, string message, params object[] args)

Parameters

actual FileInfo

A file containing the actual value

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

Exists(string)

Asserts that the file exists. If it does not exist an AssertionException is thrown.

public static void Exists(string actual)

Parameters

actual string

The path to a file containing the actual value

Exists(string, string)

Asserts that the file exists. If it does not exist an AssertionException is thrown.

public static void Exists(string actual, string message)

Parameters

actual string

The path to a file containing the actual value

message string

The message to display if objects are not equal

Exists(string, string, params object[])

Asserts that the file exists. If it does not exist an AssertionException is thrown.

public static void Exists(string actual, string message, params object[] args)

Parameters

actual string

The path to a file containing the actual value

message string

The message to display if Streams are not equal

args object[]

Arguments to be used in formatting the message

ReferenceEquals(object, object)

override the default ReferenceEquals to throw an AssertionException. This implementation makes sure there is no mistake in calling this function as part of Assert.

public static void ReferenceEquals(object a, object b)

Parameters

a object
b object