~ubuntu-branches/debian/sid/nunit/sid

« back to all changes in this revision

Viewing changes to samples/jsharp/failures/JSharpTest.jsl

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2014-09-16 13:43:36 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140916134336-kjxz48tty6lx2ja5
Tags: 2.6.3+dfsg-1
* [c7bd1b5] Imported Upstream version 2.6.3+dfsg
* [bcb4bf8] Move nunit-console-runner to GAC-installed libnunit2.6, 
  don't treat it as a private lib. This lib is signed, and treated 
  as a GAC lib by consumers such as MonoDevelop.
* [7f08e99] Bump version to 2.6.3 as required
* [84535eb] Refreshed patches
* [8479f61] Split package up into per-assembly packages. This makes 
  ABI tracking easier in the future, as we can meaningfully have GAC 
  policy for cases where ABI isn't truly bumped, and no policy for 
  cases where it is. For example, if nunit.framework bumps ABI but 
  nunit.core does not, previously we would need to rebuild everything 
  using NUnit, but under the new split packaging, that rebuild would 
  not be needed for apps only using nunit.core.
* [17a7dc7] Add missing nunit.mocks.dll to nunit.pc

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
package NUnit.Samples;
8
 
 
9
 
import System.*;
10
 
import NUnit.Framework.Assert;
11
 
 
12
 
/** @attribute NUnit.Framework.TestFixture() */
13
 
public class SimpleJSharpTest
14
 
{
15
 
        protected int fValue1;
16
 
        protected int fValue2;
17
 
 
18
 
        /** @attribute NUnit.Framework.SetUp() */
19
 
        public void Init()
20
 
        {
21
 
                fValue1 = 2;
22
 
                fValue2 = 3;
23
 
        }
24
 
 
25
 
        /** @attribute NUnit.Framework.Test() */
26
 
        public void Add() 
27
 
        {
28
 
                int result= fValue1 + fValue2;
29
 
                Assert.AreEqual(6,result, "Expected Failure");
30
 
        }
31
 
 
32
 
        /** @attribute NUnit.Framework.Test() */
33
 
        public void DivideByZero() 
34
 
        {
35
 
                int zero= 0;
36
 
                int result = 8/zero;
37
 
                KeepCompilerFromWarning(result); // never executed, here to avoid compiler warning that result is unused.
38
 
        }
39
 
 
40
 
        /** @attribute NUnit.Framework.Test() */
41
 
        public void Equals() 
42
 
        {
43
 
                Assert.AreEqual(12, 12, "Integer");
44
 
                Assert.AreEqual(new Long(12), new Long(13), "Long");
45
 
                Assert.AreEqual('a', 'a', "Char");
46
 
                Assert.AreEqual(new Integer(12), new Integer(12), "Integer Object Cast");
47
 
            
48
 
                Assert.AreEqual(12, 13, "Expected Failure (Integer)");
49
 
                Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double).");
50
 
        }
51
 
 
52
 
        /** @attribute NUnit.Framework.Test() */
53
 
        /** @attribute NUnit.Framework.Ignore("ignored test") */
54
 
        public void IgnoredTest()
55
 
        {
56
 
                throw new InvalidCastException();
57
 
        }
58
 
 
59
 
        // A useless function, designed to avoid a compiler warning in the the DivideByZero test.
60
 
        private int KeepCompilerFromWarning(int dummy)
61
 
        {
62
 
                return dummy;
63
 
        }
64
 
 
65
 
}
 
 
b'\\ No newline at end of file'