File: ExceptionNotifyFormControllerTest.cs

package info (click to toggle)
cadencii 3.3.9%2Bsvn20110818.r1732-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 35,764 kB
  • ctags: 26,929
  • sloc: cs: 160,836; java: 42,449; cpp: 7,605; ansic: 1,728; perl: 1,087; makefile: 236; php: 142; xml: 117; sh: 21
file content (43 lines) | stat: -rw-r--r-- 1,298 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Windows.Forms;
using NUnit.Framework;
using org.kbinani.cadencii;

namespace org.kbinani.cadencii
{
    [TestFixture]
    public class ExceptionNotifyFormControllerTest : ExceptionNotifyFormController
    {
        [Test]
        public void testSetReportTarget()
        {
            string expected = "OSVersion=" + Environment.OSVersion.ToString() + "\ndotNetVersion=" + System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion();
            Assert.AreEqual( expected, base.getSystemInfo() );
        }

        [Test]
        public void testExtractMessageString()
        {
            Exception ex = this.prepareException();
            string actual = base.extractMessageString( ex, 0 );
            Assert.AreEqual( "[exception-0]\r\n" + ex.Message + "\r\n" + ex.StackTrace + "\r\n", actual );
        }

        //[Test]
        public void test()
        {
            this.setReportTarget( this.prepareException() );
            this.getUi().showDialog( null );
        }

        private Exception prepareException()
        {
            try {
                int.Parse( "XYZ" );
            } catch ( Exception ex ) {
                return ex;
            }
            return null;
        }
    }
}