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
72
73
74
75
76
77
78
79
80
´╗┐using Cisco.UnityConnection.OdbcSdk;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ConnectionServerOdbcIntegrationTests.UnitTests
{
    [TestClass]
    public class ConnectionServerOdbcUnitTests
    {
        [ClassInitialize]
        public new static void ClassInitialize(TestContext testContext)
        {
            BaseUnitTests.ClassInitialize(testContext);
        }

        [TestMethod]
        public void IsValidExtensionTest_AllowBlank()
        {
            const string strExt = "";
            bool ret = ConnectionServerOdbc.IsValidExtension(strExt);
            Assert.IsTrue(ret,"blank extension with zero minimum digit length failed");

            ret = ConnectionServerOdbc.IsValidExtension(strExt,1);
            Assert.IsFalse(ret, "blank extension with 1 minimum digit length did not fail");
        }

        [TestMethod]
        public void IsValidExtensionTest_MinDigitsCheck()
        {
            const string strExt = "123";
            bool ret = ConnectionServerOdbc.IsValidExtension(strExt);
            Assert.IsTrue(ret, "valid extension with zero minimum digit length failed");

            ret = ConnectionServerOdbc.IsValidExtension(strExt,4);
            Assert.IsFalse(ret, "3 digit extension with zero 4 minimum digit length did not fail");
        }

        [TestMethod]
        public void IsValidExtensionTest_NonDigitCheck()
        {
            const string strExt = "xxx";
            bool ret = ConnectionServerOdbc.IsValidExtension(strExt);
            Assert.IsFalse(ret, "non digit extension did not fail");
        }

        [TestMethod]
        public void IsValidExtensionTest_NegativeNumberCheck()
        {
            const string strExt = "-12";
            bool ret = ConnectionServerOdbc.IsValidExtension(strExt);
            Assert.IsFalse(ret, "negative extension did not fail");
        }


        [TestMethod]
        public void IsValidDatabaseNameTests()
        {
            bool ret = ConnectionServerOdbc.IsValidDatabaseName("UnityDirDb");
            Assert.IsTrue(ret,"UnityDirDb not recognized as a valid database name");

            ret = ConnectionServerOdbc.IsValidDatabaseName("UnityDynDb");
            Assert.IsTrue(ret, "UnityDynDb not recognized as a valid database name");

            ret = ConnectionServerOdbc.IsValidDatabaseName("UnityMbxDb1");
            Assert.IsTrue(ret, "UnityMbxDb1 not recognized as a valid database name");

            ret = ConnectionServerOdbc.IsValidDatabaseName("UnityRptDb");
            Assert.IsTrue(ret, "UnityRptDb not recognized as a valid database name");

            ret = ConnectionServerOdbc.IsValidDatabaseName("Junk");
            Assert.IsFalse(ret, "Junk recognized as a valid database name");
        }

        [TestMethod]
        public void IntFromBoolTests()
        {
            Assert.IsTrue(ConnectionServerOdbc.IntFromBool(true)==1,"Bool value did not evaluate to 1 when true");
            Assert.IsTrue(ConnectionServerOdbc.IntFromBool(false) == 0, "Bool value did not evaluate to 0 when false");
        }
    }
}

Commits for ConnectionOdbcSdk/trunk/ConnectionServerOdbcIntegrationTests/UnitTests/ConnectionServerOdbcUnitTests.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.