Game Development Reference
In-Depth Information
Note
When a specific category is selected to run, only tests or test fixtures belonging to the selected
category are run.
Expected Outcome Assertion
The Assert class is used within test methods to verify known values and conditions.
For example, Assert.AreEqual() can be used after running a particular test to con-
firm that a property has a specific value.
Following are the static member methods for the Assert class and an overview of
what each one does:
Assert.AreEqual()
This comparison method tests for equality, and is perhaps the best assertion to use
because both the expected and actual values are reported. Also, the overloaded sig-
natures allow for equality comparison between equal values of varying numeric
types. This allows for assertions like the following to succeed:
Assert.AreEqual(7, 7.0);
The following are all the method signatures available for this method:
Assert.AreEqual(int expected, int actual);
Assert.AreEqual(int expected, int actual, string message);
Assert.AreEqual(int expected, int actual, string message, object[] parameters);
Assert.AreEqual(decimal expected, decimal actual);
Assert.AreEqual(decimal expected, decimal actual, string message);
Assert.AreEqual(decimal expected, decimal actual, string message, object[] parameters);
Assert.AreEqual(float expected, float actual, float tolerance);
Assert.AreEqual(float expected, float actual, float tolerance, string message);
Assert.AreEqual(float expected, float actual, float tolerance, string message,
object[] parameters);
Assert.AreEqual(double expected, double actual, double tolerance);
Assert.AreEqual(double expected, double actual, double tolerance, string message);
Assert.AreEqual(double expected, double actual, double tolerance, string message,
object[] parameters);
Assert.AreEqual(object expected, object actual);
Assert.AreEqual(object expected, object actual, string message);
Assert.AreEqual(object expected, object actual, string message, object[] parameters);
Assert.AreSame(object expected, object actual);
Assert.AreSame(object expected, object actual, string message);
 
Search Nedrilad ::




Custom Search