|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
| 3 | +using System.Xml.Linq; |
3 | 4 | using System.Linq; |
4 | 5 | using Intuit.QuickBase.Client; |
5 | 6 | using Intuit.QuickBase.Core; |
6 | 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
7 | | -using QBFunctionTest.Properties; |
8 | 8 |
|
9 | 9 | namespace QBFunctionTest |
10 | 10 | { |
11 | 11 | [TestClass] |
12 | 12 | public class UnitTest1 |
13 | 13 | { |
14 | 14 | private IQApplication qbApp; |
| 15 | + private Dictionary<string, string> qbSettings = new Dictionary<string, string>(); |
| 16 | + |
| 17 | + |
| 18 | + private void LoadSettings() |
| 19 | + { |
| 20 | + try |
| 21 | + { |
| 22 | + XDocument setDoc = XDocument.Load("TestConfigs.xml"); |
| 23 | + foreach (XElement xNod in setDoc.Root.Descendants()) |
| 24 | + { |
| 25 | + qbSettings.Add(xNod.Attribute("name").Value, xNod.Value); |
| 26 | + } |
| 27 | + |
| 28 | + } |
| 29 | + catch (Exception ex) |
| 30 | + { |
| 31 | + throw new ApplicationException("Can't load TestConfigs.xml file: " + ex.Message, ex); |
| 32 | + } |
| 33 | + } |
15 | 34 |
|
16 | 35 | public void InitConnection() |
17 | 36 | { |
18 | | - var client = QuickBase.Login(Settings.Default.qbUser, Settings.Default.qbPass, Settings.Default.qbSiteURL); |
19 | | - qbApp = client.Connect(Settings.Default.qbAppDBID, Settings.Default.qbAppToken); |
| 37 | + LoadSettings(); |
| 38 | + var client = QuickBase.Login(qbSettings["qbUser"], qbSettings["qbPass"], qbSettings["qbSiteURL"]); |
| 39 | + qbApp = client.Connect(qbSettings["qbAppDBID"], qbSettings["qbAppToken"]); |
20 | 40 |
|
21 | 41 | } |
22 | 42 |
|
@@ -73,6 +93,29 @@ public void Setup2ndValues() |
73 | 93 |
|
74 | 94 | } |
75 | 95 |
|
| 96 | + [TestMethod] |
| 97 | + public void LargeTableHandling() |
| 98 | + { |
| 99 | + InitConnection(); |
| 100 | + IQTable orderTable = qbApp.GetTable(qbSettings["qbBigTable"]); |
| 101 | + Query qry = new Query(); |
| 102 | + QueryStrings lstQry = new QueryStrings(1, ComparisonOperator.IR, "last 60 d", |
| 103 | + LogicalOperator.NONE); |
| 104 | + qry.Add(lstQry); |
| 105 | + int maxRec = 100000; |
| 106 | + orderTable.Query(qry, $"skp-10.num-{maxRec}"); |
| 107 | + Assert.AreEqual(maxRec, orderTable.Records.Count); |
| 108 | + List<string> idLst = new List<string>(); |
| 109 | + foreach (QRecord rec in orderTable.Records) |
| 110 | + { |
| 111 | + string id = (string) rec["Record ID#"]; |
| 112 | + if (idLst.Contains(id)) |
| 113 | + Assert.Fail("Duplicate ID found!"); |
| 114 | + else |
| 115 | + idLst.Add(id); |
| 116 | + } |
| 117 | + } |
| 118 | + |
76 | 119 | [TestMethod] |
77 | 120 | public void BasicCreationAndRoundTripTest() |
78 | 121 | { |
|
0 commit comments