source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/lib/NUnit/NUnit-2.5.10.11092/samples/cpp/cpp-cli/failures/cppsample.cpp@ 1146

Last change on this file since 1146 was 1146, checked in by Sam Habiel, 13 years ago

Initial Import of BMX4

File size: 1.1 KB
Line 
1// ****************************************************************
2// This is free software licensed under the NUnit license. You
3// may obtain a copy of the license as well as information regarding
4// copyright ownership at http://nunit.org/?p=license&r=2.4.
5// ****************************************************************
6
7#include "cppsample.h"
8
9namespace NUnitSamples {
10
11 void SimpleCPPSample::Init() {
12 fValue1 = 2;
13 fValue2 = 3;
14 }
15
16 void SimpleCPPSample::Add() {
17 int result = fValue1 + fValue2;
18 Assert::AreEqual(6,result);
19 }
20
21 void SimpleCPPSample::DivideByZero()
22 {
23 int zero= 0;
24 int result= 8/zero;
25 }
26
27 void SimpleCPPSample::Equals() {
28 Assert::AreEqual(12, 12, "Integer");
29 Assert::AreEqual(12L, 12L, "Long");
30 Assert::AreEqual('a', 'a', "Char");
31
32
33 Assert::AreEqual(12, 13, "Expected Failure (Integer)");
34 Assert::AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double)");
35 }
36
37 void SimpleCPPSample::IgnoredTest()
38 {
39 throw gcnew InvalidCastException();
40 }
41
42 void SimpleCPPSample::ExpectAnException()
43 {
44 throw gcnew InvalidCastException();
45 }
46
47}
48
Note: See TracBrowser for help on using the repository browser.