Subversion Repository Public Repository

ConnectionOdbcSdk

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
´╗┐using System;
using Cisco.UnityConnection.OdbcSdk;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnityConnectionServerOdbcTests
{
    [TestClass]
    public class EventUnitTests : BaseUnitTests
    {

        #region Additional test attributes

        private bool _debugEventCalled;
        private bool _errorEventCalled;

        [ClassInitialize]
        public new static void ClassInitialize(TestContext testContext)
        {
            BaseUnitTests.ClassInitialize(testContext);
        }

        #endregion

        [TestMethod]
        public void DebugTest_DebugOn()
        {
            _debugEventCalled = false;
            MockServer.DebugMode = true;
            MockServer.DebugEvents += MockServerOnDebugEvents;
            MockServer.GetDefaultLanguage();
            Assert.IsTrue(_debugEventCalled,"Debug event not fired for GetDefaultLanguage");
        }

        [TestMethod]
        public void DebugTest_DebugOff()
        {
            _debugEventCalled = false;
            MockServer.DebugMode = false;
            MockServer.DebugEvents += MockServerOnDebugEvents;
            MockServer.GetDefaultLanguage();
            Assert.IsFalse(_debugEventCalled, "Debug event fired when debug is off for GetDefaultLanguage");
        }

        [TestMethod]
        public void ErrorTest()
        {
            IConnectionDatabaseFunctions oDbTest = new UnityConnectionDatabaseFunctionsInformixAdoNet("test");
            UnityConnectionServerOdbc oTest = new UnityConnectionServerOdbc(oDbTest);
            _errorEventCalled = false;
            oTest.DebugMode = false;
            oTest.ErrorEvents += OTestOnErrorEvents;
            oTest.ChangeActiveDatabase("");
            Assert.IsTrue(_errorEventCalled, "Error event did not fire when error issued for dbfetch");
        }

        private void OTestOnErrorEvents(object sender, LogEventArgs logEventArgs)
        {
            _errorEventCalled = true;
            Console.WriteLine("[ERROR] " + logEventArgs.Line);
        }


        private void MockServerOnDebugEvents(object sender, LogEventArgs logEventArgs)
        {
            _debugEventCalled = true;
            Console.WriteLine("[DEBUG] "+logEventArgs.Line);
            Console.WriteLine("[DEBUG] toString override=" + logEventArgs);
            
        }
    }
}

Commits for ConnectionOdbcSdk/trunk/ConnectionServerOdbcIntegrationTests/UnitTests/EventUnitTests.cs

Diff revisions: vs.
Revision Author Commited Message
19 Diff Diff jlindborg picture jlindborg Mon 06 Jan, 2014 22:26:38 +0000

renaming and reorganizing unit tests a bit.

15 Diff Diff jlindborg picture jlindborg Sun 08 Sep, 2013 17:27:35 +0000

2.0.3
Changed class name to be CiscoUnityConnectionServerOdbc
Updated to support 32 or 64 bit projects
Changed order of parameters on login methods at server and DB functions class to match.
Started testing for NuGet package deployment.
Dropped in holder for dev guide docs

9 jlindborg picture jlindborg Fri 30 Aug, 2013 19:10:27 +0000

more unit and integration test setup work.