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
´╗┐using System;
using Cisco.UnityConnection.OdbcSdk;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace ConnectionServerOdbcIntegrationTests
{
    public abstract class BaseUnitTests
    {
        // ReSharper does not handle the Assert. calls in unit test property - turn off checking for unreachable code
        // ReSharper disable HeuristicUnreachableCode

        #region Fields and Properties

        public static Mock<IConnectionDatabaseFunctions> MockDbFunctions { get; set; }

        public static ConnectionServerOdbc MockServer { get; set; }

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public static TestContext TestContext { get; set; }

        #endregion


        #region Additional test attributes

        public static void Reset()
        {
            ClassInitialize(TestContext);
        }

        [ClassInitialize]
        public static void ClassInitialize(TestContext testContext)
        {
            TestContext = testContext;

            //setup mock server interface 
            MockDbFunctions = new Mock<IConnectionDatabaseFunctions>();

            try
            {
                MockServer = new ConnectionServerOdbc(MockDbFunctions.Object);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Failed creating mock server instance:" + ex);
            }

            MockServer.ErrorEvents += MockServerOnErrorEvents;
        }

        private static void MockServerOnErrorEvents(object sender, LogEventArgs logEventArgs)
        {
            Console.WriteLine("Error raised on Mock ODBC server:"+logEventArgs.Line);
        }

        #endregion
    }
}

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

Diff revisions: vs.
Revision Author Commited Message
9 jlindborg picture jlindborg Fri 30 Aug, 2013 19:10:27 +0000

more unit and integration test setup work.