

ConnectionOdbcSdk
@ 9
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 ConnectionServerOdbcIntegrationTests.UnitTests { [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 ConnectionInformixAdoNetDatabaseFunctions("test"); ConnectionServerOdbc oTest = new ConnectionServerOdbc(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
Revision | Author | Commited | Message |
---|---|---|---|
9 |
![]() |
Fri 30 Aug, 2013 19:10:27 +0000 | more unit and integration test setup work. |