public void GetEntryList_qulifier_fieldIds_nopage_nocount_noorder_success() { ARSession session = new ARSession(); try { int total = -1; session.Login(TestServer, TestAdmin, TestAdminPwd); List <UInt32> fieldIds = new List <UInt32>(); fieldIds.Add(TestCharacterFieldId); fieldIds.Add(TestIntFieldId); //fieldIds.Add(1); var retlist = session.GetEntryList( TestRegularFormName, "'Character Field' LIKE \"%你好%\"", fieldIds.ToArray(), null, null, ref total, null ); Assert.AreEqual(11, retlist.Count); Assert.AreEqual(-1, total); foreach (var entry in retlist) { //Assert.AreEqual(entry.EntryIds.First(), entry.FieldValues.First(f => f.FieldId == 1).Value.ToString()); Assert.IsTrue(entry.FieldValues.First(f => f.FieldId == TestCharacterFieldId).Value.ToString().Contains("你好")); } } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public static void Cleanup() { //cleanup the user which has been created in Initialize ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <uint> fieldIds = new List <uint>(); fieldIds.Add(1u); int total = -1; var entry = session.GetEntryList("User", "'101'=\"周平\"", fieldIds.ToArray(), null, null, ref total, null); if (entry != null || entry.Count != 0) { foreach (var e in entry) { session.DeleteEntry("User", e.EntryIds.ToArray()); } } } finally { session.LogOut(); } }
public void GetEntryListStatictisc_count_noqulifier_nogroup_success() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <UInt32> groupIds = new List <UInt32>(); groupIds.Add(TestCharacterFieldId); var retlist = session.GetListEntryStatictisc( TestRegularFormName, null,//"'Character Field' = \"Hello Remedy\"", ARStatictisc.STAT_OP_COUNT, null, null ); Assert.AreEqual(1, retlist.Count); Assert.AreEqual(18, Convert.ToInt32(retlist[0].Statictisc)); Assert.AreEqual(null, retlist[0].GroupByValues); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public static void Initialize(TestContext context) { ARSession session = new ARSession(); try { session.Login(TestServer,TestAdmin,TestAdminPwd); int totalCount = -1; List<AREntry> allentries = session.GetEntryList( TestRegularFormName, null, null, null, null, ref totalCount, null); foreach (AREntry entry in allentries) { session.DeleteEntry(TestRegularFormName,entry.EntryIds.ToArray()); } } catch (ARException ex) { } finally { session.LogOut(); } }
public static void Initialize(TestContext context) { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); int totalCount = -1; List <AREntry> allentries = session.GetEntryList( TestRegularFormName, null, null, null, null, ref totalCount, null); foreach (AREntry entry in allentries) { session.DeleteEntry(TestRegularFormName, entry.EntryIds.ToArray()); } } catch (ARException ex) { } finally { session.LogOut(); } }
public void GetEntryListStatictisc_min_qulifier_group_success() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <UInt32> groupIds = new List <UInt32>(); groupIds.Add(TestCharacterFieldId); var retlist = session.GetListEntryStatictisc( TestRegularFormName, "'Character Field' LIKE \"%你好%\"", ARStatictisc.STAT_OP_MINIMUM, TestIntFieldId, groupIds.ToArray() ); Assert.AreEqual(2, retlist.Count); Dictionary <String, int> assertTable = new Dictionary <string, int>(); //assertTable.Add("Hello Remedy", 7); assertTable.Add("你好 RemedySet Something", 1); assertTable.Add("你好 Remedy", 1); Assert.AreEqual(assertTable[retlist[0].GroupByValues[0].ToString()], Convert.ToInt32(retlist[0].Statictisc)); Assert.AreEqual(assertTable[retlist[1].GroupByValues[0].ToString()], Convert.ToInt32(retlist[1].Statictisc)); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_Enum_Status_NULL() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestRadioFieldId, null, ARDataType.DATA_TYPE_ENUM));//set null for the status character string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List <string> entryIds = new List <string>(); entryIds.Add(entryid); List <uint> fieldIds = new List <uint>(); fieldIds.Add(TestRadioFieldId); List <ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_NULL, Entry[0].DataType); Assert.AreEqual(TestRadioFieldId, Entry[0].FieldId); Assert.AreEqual(null, Entry[0].Value); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void Logout() { if (SessionInstance == null) { return; } SessionInstance.LogOut(); }
public void ARSession_Transcation_Create_Set_Success() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); var entrytobeset = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //begin Transaction session.BeginBulkEntryTransaction(); //create session.CreateEntry(TestRegularFormName, valuelist.ToArray()); List <string> entryid = new List <string>() { entrytobeset }; List <ARFieldValue> up_fvs = new List <ARFieldValue>(); up_fvs.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR)); //let the second call success too session.SetEntry(TestRegularFormName, entryid.ToArray(), up_fvs.ToArray()); //commit var result = session.EndBulkEntryTransaction(1); Assert.IsTrue(result.Success); Assert.AreEqual(2, result.ResultList.Count); Assert.AreEqual(EntryCallType.BULK_ENTRY_CREATE, result.ResultList[0].CallType); var entryid1 = result.ResultList[0].EntryId; Assert.IsNull(result.ResultList[0].Status); Assert.AreEqual(EntryCallType.BULK_ENTRY_SET, result.ResultList[1].CallType); Assert.IsNull(result.ResultList[1].Status); List <string> entryIds = new List <string>(); entryIds.Add(entryid1); List <uint> fieldIds = new List <uint>(); fieldIds.Add((uint)TestCharacterFieldId); List <ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(TestCharacterFieldValue, Entry.First(f => f.FieldId == TestCharacterFieldId).Value.ToString()); List <ARFieldValue> Entry2UP = session.GetEntry(TestRegularFormName, entryid.ToArray(), fieldIds.ToArray()); Assert.AreEqual(TestCharacterFieldValueChinese, Entry2UP.First(f => f.FieldId == TestCharacterFieldId).Value.ToString()); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public static void Initialize(TestContext context) { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); int totalCount = -1; List <AREntry> allentries = session.GetEntryList( TestRegularFormName, null, null, null, null, ref totalCount, null); foreach (AREntry entry in allentries) { session.DeleteEntry(TestRegularFormName, entry.EntryIds.ToArray()); } //add test data List <ARFieldValue> fv1 = new List <ARFieldValue>(); fv1.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); fv1.Add(new ARFieldValue(TestIntFieldId, 1, ARDataType.DATA_TYPE_INTEGER)); List <ARFieldValue> fv2 = new List <ARFieldValue>(); fv2.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR)); fv2.Add(new ARFieldValue(TestIntFieldId, 1, ARDataType.DATA_TYPE_INTEGER)); List <ARFieldValue> fv3 = new List <ARFieldValue>(); fv3.Add(new ARFieldValue(TestCharacterFieldId, (object)(TestCharacterFieldValueChinese + "Set Something"), ARDataType.DATA_TYPE_CHAR)); fv3.Add(new ARFieldValue(TestIntFieldId, 1, ARDataType.DATA_TYPE_INTEGER)); for (int i = 0; i < 7; i++) { session.CreateEntry(TestRegularFormName, fv1.ToArray()); } for (int i = 0; i < 9; i++) { session.CreateEntry(TestRegularFormName, fv2.ToArray()); } for (int i = 0; i < 2; i++) { session.CreateEntry(TestRegularFormName, fv3.ToArray()); } } catch (ARException ex) { } finally { session.LogOut(); } }
public void Login_with_admin_failed_cause_bad_pwd() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd + "something"); } catch (ARException ex) { Assert.AreEqual(623, ex.MessageNumber); //183977-ErrorMsgs-7604.pdf page 72 } session.LogOut(); }
public void Login_with_admin_success() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public static void Initialize(TestContext context) { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); int totalCount = -1; List<AREntry> allentries = session.GetEntryList( TestRegularFormName, null, null, null, null, ref totalCount, null); foreach (AREntry entry in allentries) { session.DeleteEntry(TestRegularFormName, entry.EntryIds.ToArray()); } //add test data List<ARFieldValue> fv1 = new List<ARFieldValue>(); fv1.Add(new ARFieldValue(TestCharacterFieldId,(object)TestCharacterFieldValue,ARDataType.DATA_TYPE_CHAR)); fv1.Add(new ARFieldValue(TestIntFieldId,1,ARDataType.DATA_TYPE_INTEGER)); List<ARFieldValue> fv2 = new List<ARFieldValue>(); fv2.Add(new ARFieldValue(TestCharacterFieldId,(object)TestCharacterFieldValueChinese,ARDataType.DATA_TYPE_CHAR)); fv2.Add(new ARFieldValue(TestIntFieldId,1,ARDataType.DATA_TYPE_INTEGER)); List<ARFieldValue> fv3 = new List<ARFieldValue>(); fv3.Add(new ARFieldValue(TestCharacterFieldId,(object)(TestCharacterFieldValueChinese + "Set Something"),ARDataType.DATA_TYPE_CHAR)); fv3.Add(new ARFieldValue(TestIntFieldId,1,ARDataType.DATA_TYPE_INTEGER)); for (int i = 0; i < 7; i++) session.CreateEntry(TestRegularFormName, fv1.ToArray()); for (int i = 0; i < 9; i++) session.CreateEntry(TestRegularFormName, fv2.ToArray()); for (int i = 0; i < 2; i++) session.CreateEntry(TestRegularFormName, fv3.ToArray()); } catch (ARException ex) { } finally { session.LogOut(); } }
public void GetEntryList_qulifier_fieldIds_nopage_hascount_hasorder_success() { ARSession session = new ARSession(); try { int total = 0; session.Login(TestServer, TestAdmin, TestAdminPwd); List <UInt32> fieldIds = new List <UInt32>(); fieldIds.Add(TestCharacterFieldId); fieldIds.Add(TestIntFieldId); List <ARSortInfo> sortInfo = new List <ARSortInfo>(); sortInfo.Add(new ARSortInfo { FieldId = TestCharacterFieldId, Order = SortOrder.SORT_DESCENDING }); var retlist = session.GetEntryList( TestRegularFormName, "'Character Field' LIKE \"%你好%\"", fieldIds.ToArray(), null, null, ref total, sortInfo.ToArray() ); Assert.AreEqual(11, retlist.Count); Assert.AreEqual(11, total); foreach (var entry in retlist) { //Assert.AreEqual(entry.EntryIds.First(), entry.FieldValues.First(f => f.FieldId == 1).Value.ToString()); Assert.IsTrue(entry.FieldValues.First(f => f.FieldId == TestCharacterFieldId).Value.ToString().Contains("你好")); } string maxentrylist = retlist.Max(e => e.EntryIds.First()); string minentrylist = retlist.Min(e => e.EntryIds.First()); Assert.AreEqual(10, Convert.ToInt32(maxentrylist) - Convert.ToInt32(minentrylist)); Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[0].FieldValues[0].Value); Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[1].FieldValues[0].Value); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_field_not_found_311() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldIdNotExist, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); session.CreateEntry(TestRegularFormName, valuelist.ToArray()); } catch (ARException ex) { Assert.AreEqual(311, ex.MessageNumber); //183977-ErrorMsgs-7604.pdf page 50 } session.LogOut(); }
public void ARSession_Transcation_Create_Create_Failed() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); //begin Transaction session.BeginBulkEntryTransaction(); //create session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //let the second call failed valuelist.Add(new ARFieldValue(7u, null, ARDataType.DATA_TYPE_NULL)); session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //commit var result = session.EndBulkEntryTransaction(1); Assert.IsFalse(result.Success); Assert.AreEqual(2, result.ResultList.Count); Assert.AreEqual(EntryCallType.BULK_ENTRY_CREATE, result.ResultList[0].CallType); var entryid1 = result.ResultList[0].EntryId; Assert.IsNull(result.ResultList[0].Status); Assert.AreEqual(EntryCallType.BULK_ENTRY_CREATE, result.ResultList[1].CallType); Assert.AreEqual(null, result.ResultList[1].EntryId); Assert.IsNotNull(result.ResultList[1].Status); Assert.AreEqual(326, result.ResultList[1].Status.MessageNumber); List <string> entryIds = new List <string>(); entryIds.Add(entryid1); List <uint> fieldIds = new List <uint>(); fieldIds.Add((uint)TestCharacterFieldId); List <ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.IsNull(Entry); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void ARSession_Transcation_Create_Set_Failed() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); //begin Transaction session.BeginBulkEntryTransaction(); //create session.CreateEntry(TestRegularFormName, valuelist.ToArray()); List <string> entryid = new List <string>() { "111111111111" }; //entryid do not exist List <ARFieldValue> up_fvs = new List <ARFieldValue>(); up_fvs.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR)); //let the second call failed session.SetEntry(TestRegularFormName, entryid.ToArray(), up_fvs.ToArray()); //commit var result = session.EndBulkEntryTransaction(1); Assert.IsFalse(result.Success); Assert.AreEqual(2, result.ResultList.Count); Assert.AreEqual(EntryCallType.BULK_ENTRY_CREATE, result.ResultList[0].CallType); var entryid1 = result.ResultList[0].EntryId; Assert.IsNull(result.ResultList[0].Status); Assert.AreEqual(EntryCallType.BULK_ENTRY_SET, result.ResultList[1].CallType); Assert.IsNotNull(result.ResultList[1].Status); //item do not exist in the db Assert.AreEqual(302, result.ResultList[1].Status.MessageNumber); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_DateTime() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List <ARFieldValue> valuelist = new List <ARFieldValue>(); //convert datetime to second from 1970-1-1 TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1); int secondtoNow = (int)ts.TotalSeconds; valuelist.Add(new ARFieldValue(TestDateTimeFieldId, secondtoNow, ARDataType.DATA_TYPE_TIME)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List <string> entryIds = new List <string>(); entryIds.Add(entryid); List <uint> fieldIds = new List <uint>(); fieldIds.Add((uint)TestDateTimeFieldId); List <ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_TIME, Entry[0].DataType); Assert.AreEqual(TestDateTimeFieldId, Entry[0].FieldId); Assert.AreEqual(secondtoNow, Entry[0].Value); //Set valuelist.Clear(); valuelist.Add(new ARFieldValue(TestDateTimeFieldId, secondtoNow + 100, ARDataType.DATA_TYPE_TIME)); session.SetEntry(TestRegularFormName, entryIds.ToArray(), valuelist.ToArray()); //Get for Assert Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_TIME, Entry[0].DataType); Assert.AreEqual(TestDateTimeFieldId, Entry[0].FieldId); Assert.AreEqual(secondtoNow + 100, Entry[0].Value); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_Time() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List <ARFieldValue> valuelist = new List <ARFieldValue>(); DateTime dt = DateTime.Now; int secondtoNow = dt.Hour * 3600 + dt.Minute * 60 + dt.Second; valuelist.Add(new ARFieldValue(TestTimeFieldId, secondtoNow, ARDataType.DATA_TYPE_TIME_OF_DAY)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List <string> entryIds = new List <string>(); entryIds.Add(entryid); List <uint> fieldIds = new List <uint>(); fieldIds.Add((uint)TestTimeFieldId); List <ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_TIME_OF_DAY, Entry[0].DataType); Assert.AreEqual(TestTimeFieldId, Entry[0].FieldId); Assert.AreEqual(secondtoNow, Entry[0].Value); //Set valuelist.Clear(); valuelist.Add(new ARFieldValue(TestTimeFieldId, secondtoNow + 100, ARDataType.DATA_TYPE_TIME_OF_DAY)); session.SetEntry(TestRegularFormName, entryIds.ToArray(), valuelist.ToArray()); //Get for Assert Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_TIME_OF_DAY, Entry[0].DataType); Assert.AreEqual(TestTimeFieldId, Entry[0].FieldId); Assert.AreEqual(secondtoNow + 100, Entry[0].Value); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_character_chinese_with_set() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR)); string entryId = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); Assert.AreNotEqual(null, entryId); //GetEntry List <string> IdList = new List <string>(); IdList.Add(entryId); List <uint> FIdList = new List <uint>(); FIdList.Add((uint)TestCharacterFieldId); List <ARFieldValue> fieldsReturns = session.GetEntry(TestRegularFormName, IdList.ToArray(), FIdList.ToArray()); Assert.AreEqual(1, fieldsReturns.Count); Assert.AreEqual(ARDataType.DATA_TYPE_CHAR, fieldsReturns[0].DataType); Assert.AreEqual(TestCharacterFieldId, fieldsReturns[0].FieldId); Assert.AreEqual(TestCharacterFieldValueChinese, fieldsReturns[0].Value.ToString()); //SetEntry fieldsReturns.Clear(); fieldsReturns.Add(new ARFieldValue(TestCharacterFieldId, (object)(TestCharacterFieldValueChinese + "Set Something"), ARDataType.DATA_TYPE_CHAR)); session.SetEntry(TestRegularFormName, IdList.ToArray(), fieldsReturns.ToArray()); //GetAgain fieldsReturns.Clear(); fieldsReturns = session.GetEntry(TestRegularFormName, IdList.ToArray(), FIdList.ToArray()); Assert.AreEqual(1, fieldsReturns.Count); Assert.AreEqual(ARDataType.DATA_TYPE_CHAR, fieldsReturns[0].DataType); Assert.AreEqual(TestCharacterFieldId, fieldsReturns[0].FieldId); Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", fieldsReturns[0].Value.ToString()); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_Enum_Status() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(7, 1, ARDataType.DATA_TYPE_ENUM)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List <string> entryIds = new List <string>(); entryIds.Add(entryid); List <uint> fieldIds = new List <uint>(); fieldIds.Add(7); List <ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_ENUM, Entry[0].DataType); Assert.AreEqual(7, (int)Entry[0].FieldId); Assert.AreEqual((UInt32)1, Entry[0].Value); //Set valuelist.Clear(); valuelist.Add(new ARFieldValue(7, 2, ARDataType.DATA_TYPE_ENUM)); session.SetEntry(TestRegularFormName, entryIds.ToArray(), valuelist.ToArray()); //Get for Assert Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_ENUM, Entry[0].DataType); Assert.AreEqual(7, (int)Entry[0].FieldId); Assert.AreEqual((UInt32)2, Entry[0].Value); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_Decimal() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestDecimalFieldId, 3.14, ARDataType.DATA_TYPE_DECIMAL)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List <string> entryIds = new List <string>(); entryIds.Add(entryid); List <uint> fieldIds = new List <uint>(); fieldIds.Add((uint)TestDecimalFieldId); List <ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_DECIMAL, Entry[0].DataType); Assert.AreEqual(TestDecimalFieldId, Entry[0].FieldId); Assert.AreEqual(3.14, Convert.ToDouble(Entry[0].Value)); //Set valuelist.Clear(); valuelist.Add(new ARFieldValue(TestDecimalFieldId, 0.61, ARDataType.DATA_TYPE_DECIMAL)); session.SetEntry(TestRegularFormName, entryIds.ToArray(), valuelist.ToArray()); //Get for Assert Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_DECIMAL, Entry[0].DataType); Assert.AreEqual(TestDecimalFieldId, Entry[0].FieldId); Assert.AreEqual(0.61, Convert.ToDouble(Entry[0].Value)); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public static void Cleanup() { //cleanup the user which has been created in Initialize ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<uint> fieldIds = new List<uint>(); fieldIds.Add(1u); int total = -1; var entry = session.GetEntryList("User", "'101'=\"周平\"", fieldIds.ToArray(), null, null, ref total, null); if (entry != null || entry.Count != 0){ foreach (var e in entry) session.DeleteEntry("User", e.EntryIds.ToArray()); } } finally { session.LogOut(); } }
public void Impersonat_Create_Test() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); session.SetImpersonatedUser(ImpersonatedChineseUser); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); List <string> entryIds = new List <string>(); entryIds.Add(entryid); List <uint> fieldIds = new List <uint>(); fieldIds.Add((uint)TestCharacterFieldId); fieldIds.Add(2); fieldIds.Add(5); session.SetImpersonatedUser(null); List <ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(TestCharacterFieldValue, Entry.First(f => f.FieldId == TestCharacterFieldId).Value.ToString()); Assert.AreEqual(ImpersonatedChineseUser, Entry.First(f => f.FieldId == 2).Value.ToString()); Assert.AreEqual(ImpersonatedChineseUser, Entry.First(f => f.FieldId == 5).Value.ToString()); } catch (ARException ex) { Assert.AreEqual(null, ex); } finally { session.LogOut(); } }
public void ARSession_ServerInfo_Get_SERVER_INFO_MAX_ENTRIES() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <uint> tar = new List <uint>(); tar.Add((uint)ServerInfoType.SERVER_INFO_MAX_ENTRIES); var result = session.GetServerInfo(tar.ToArray()); Assert.AreEqual(1, result.Count); Assert.AreEqual(ServerInfoType.SERVER_INFO_MAX_ENTRIES, result[0].Type); } catch (Exception ex) { Assert.AreEqual(null, ex); } finally { session.LogOut(); } }
public static void Initialize(TestContext context) { //create a user which has login name with unicode character ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(101u, "周平", ARDataType.DATA_TYPE_CHAR)); valuelist.Add(new ARFieldValue(8u, "周平", ARDataType.DATA_TYPE_CHAR)); valuelist.Add(new ARFieldValue(102u, "123", ARDataType.DATA_TYPE_CHAR)); valuelist.Add(new ARFieldValue(109u, 1, ARDataType.DATA_TYPE_ENUM)); session.CreateEntry("User", valuelist.ToArray()); ImpersonatedChineseUser = "******"; } finally { session.LogOut(); } }
public void ARSession_ServerInfo_Get_SERVER_INFO_MAX_ENTRIES() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<uint> tar = new List<uint>(); tar.Add((uint)ServerInfoType.SERVER_INFO_MAX_ENTRIES); var result = session.GetServerInfo(tar.ToArray()); Assert.AreEqual(1,result.Count); Assert.AreEqual(ServerInfoType.SERVER_INFO_MAX_ENTRIES, result[0].Type); } catch (Exception ex) { Assert.AreEqual(null, ex); } finally { session.LogOut(); } }
public void Login_with_admin_failed_and_try_a_success_again() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd + "something"); } catch (ARException ex) { Assert.AreEqual(623, ex.MessageNumber); //183977-ErrorMsgs-7604.pdf page 72 try { session.Login(TestServer, TestAdmin, TestAdminPwd); } catch { Assert.AreEqual(null, ex); } } session.LogOut(); }
public static void Initialize(TestContext context) { //clean first Cleanup(); //create a user which has login name with unicode character ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(101u, "周平", ARDataType.DATA_TYPE_CHAR)); valuelist.Add(new ARFieldValue(8u, "周平", ARDataType.DATA_TYPE_CHAR)); valuelist.Add(new ARFieldValue(102u, "123", ARDataType.DATA_TYPE_CHAR)); session.CreateEntry("User", valuelist.ToArray()); TestChineseUser = "******"; TestChineseUserPwd = "123"; } finally { session.LogOut(); } }
public void Impersonat_Create_Test_but_User_Not_Exist() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); session.SetImpersonatedUser("周平123"); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); } catch (ARException ex) { Assert.AreEqual(623, ex.MessageNumber); //authentication failed } finally { session.LogOut(); } }
public void ARSession_Transcation_Create_Set_Cancel() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List <ARFieldValue> valuelist = new List <ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); var entrytobeset = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //begin Transaction session.BeginBulkEntryTransaction(); //create session.CreateEntry(TestRegularFormName, valuelist.ToArray()); List <string> entryid = new List <string>() { entrytobeset }; List <ARFieldValue> up_fvs = new List <ARFieldValue>(); up_fvs.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR)); //let the second call success too session.SetEntry(TestRegularFormName, entryid.ToArray(), up_fvs.ToArray()); //commit var result = session.EndBulkEntryTransaction(2); Assert.IsTrue(result.Success); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_Real() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(TestRealFieldId, 3.1415926, ARDataType.DATA_TYPE_REAL)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List<string> entryIds = new List<string>(); entryIds.Add(entryid); List<uint> fieldIds = new List<uint>(); fieldIds.Add((uint)TestRealFieldId); List<ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_REAL, Entry[0].DataType); Assert.AreEqual(TestRealFieldId, Entry[0].FieldId); Assert.AreEqual(3.1415926, Entry[0].Value); //Set valuelist.Clear(); valuelist.Add(new ARFieldValue(TestRealFieldId, 0.618, ARDataType.DATA_TYPE_REAL)); session.SetEntry(TestRegularFormName, entryIds.ToArray(), valuelist.ToArray()); //Get for Assert Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_REAL, Entry[0].DataType); Assert.AreEqual(TestRealFieldId, Entry[0].FieldId); Assert.AreEqual(0.618, Entry[0].Value); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_character_chinese_with_set() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR)); string entryId = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); Assert.AreNotEqual(null, entryId); //GetEntry List<string> IdList = new List<string>(); IdList.Add(entryId); List<uint> FIdList = new List<uint>(); FIdList.Add((uint)TestCharacterFieldId); List<ARFieldValue> fieldsReturns = session.GetEntry(TestRegularFormName, IdList.ToArray(), FIdList.ToArray()); Assert.AreEqual(1, fieldsReturns.Count); Assert.AreEqual(ARDataType.DATA_TYPE_CHAR, fieldsReturns[0].DataType); Assert.AreEqual(TestCharacterFieldId, fieldsReturns[0].FieldId); Assert.AreEqual(TestCharacterFieldValueChinese, fieldsReturns[0].Value.ToString()); //SetEntry fieldsReturns.Clear(); fieldsReturns.Add(new ARFieldValue(TestCharacterFieldId,(object)(TestCharacterFieldValueChinese + "Set Something"),ARDataType.DATA_TYPE_CHAR)); session.SetEntry(TestRegularFormName, IdList.ToArray(), fieldsReturns.ToArray()); //GetAgain fieldsReturns.Clear(); fieldsReturns = session.GetEntry(TestRegularFormName, IdList.ToArray(), FIdList.ToArray()); Assert.AreEqual(1, fieldsReturns.Count); Assert.AreEqual(ARDataType.DATA_TYPE_CHAR, fieldsReturns[0].DataType); Assert.AreEqual(TestCharacterFieldId, fieldsReturns[0].FieldId); Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", fieldsReturns[0].Value.ToString()); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void Login_with_chinese_admin_success() { ARSession session = new ARSession(); try { session.Login(TestServer, TestChineseUser, TestChineseUserPwd); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_simple_success() { ARSession session = new ARSession(); try{ session.Login(TestServer, TestAdmin, TestAdminPwd); List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId,(object)TestCharacterFieldValue,ARDataType.DATA_TYPE_CHAR)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); List<string> entryIds = new List<string>(); entryIds.Add(entryid); List<uint> fieldIds = new List<uint>(); fieldIds.Add((uint)TestCharacterFieldId); List<ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(TestCharacterFieldValue, Entry.First(f => f.FieldId == TestCharacterFieldId).Value.ToString()); } catch(ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void SetEntry_datatype_Enum_Status_NULL() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(TestRadioFieldId, 1, ARDataType.DATA_TYPE_ENUM)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List<string> entryIds = new List<string>(); entryIds.Add(entryid); List<uint> fieldIds = new List<uint>(); fieldIds.Add(TestRadioFieldId); List<ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_ENUM, Entry[0].DataType); Assert.AreEqual(TestRadioFieldId, Entry[0].FieldId); Assert.AreEqual((UInt32)1, Entry[0].Value); //Set valuelist.Clear(); valuelist.Add(new ARFieldValue(TestRadioFieldId, null, ARDataType.DATA_TYPE_ENUM)); session.SetEntry(TestRegularFormName, entryIds.ToArray(), valuelist.ToArray()); //Get for Assert Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_NULL, Entry[0].DataType); Assert.AreEqual(TestRadioFieldId, Entry[0].FieldId); Assert.AreEqual(null, Entry[0].Value); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void ARSession_Transcation_Create_Set_Failed() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); //begin Transaction session.BeginBulkEntryTransaction(); //create session.CreateEntry(TestRegularFormName, valuelist.ToArray()); List<string> entryid = new List<string>() { "111111111111" };//entryid do not exist List<ARFieldValue> up_fvs = new List<ARFieldValue>(); up_fvs.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR)); //let the second call failed session.SetEntry(TestRegularFormName, entryid.ToArray(), up_fvs.ToArray()); //commit var result = session.EndBulkEntryTransaction(1); Assert.IsFalse(result.Success); Assert.AreEqual(2, result.ResultList.Count); Assert.AreEqual(EntryCallType.BULK_ENTRY_CREATE, result.ResultList[0].CallType); var entryid1 = result.ResultList[0].EntryId; Assert.IsNull(result.ResultList[0].Status); Assert.AreEqual(EntryCallType.BULK_ENTRY_SET, result.ResultList[1].CallType); Assert.IsNotNull(result.ResultList[1].Status); //item do not exist in the db Assert.AreEqual(302, result.ResultList[1].Status.MessageNumber); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void ARSession_Transcation_Create_Set_Cancel() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); var entrytobeset = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //begin Transaction session.BeginBulkEntryTransaction(); //create session.CreateEntry(TestRegularFormName, valuelist.ToArray()); List<string> entryid = new List<string>() { entrytobeset }; List<ARFieldValue> up_fvs = new List<ARFieldValue>(); up_fvs.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR)); //let the second call success too session.SetEntry(TestRegularFormName, entryid.ToArray(), up_fvs.ToArray()); //commit var result = session.EndBulkEntryTransaction(2); Assert.IsTrue(result.Success); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void GetEntryList_qulifier_fieldIds_nopage_nocount_noorder_success() { ARSession session = new ARSession(); try { int total = -1; session.Login(TestServer, TestAdmin, TestAdminPwd); List<UInt32> fieldIds = new List<UInt32>(); fieldIds.Add(TestCharacterFieldId); fieldIds.Add(TestIntFieldId); //fieldIds.Add(1); var retlist = session.GetEntryList( TestRegularFormName, "'Character Field' LIKE \"%你好%\"", fieldIds.ToArray(), null, null, ref total, null ); Assert.AreEqual(11, retlist.Count); Assert.AreEqual(-1, total); foreach (var entry in retlist) { //Assert.AreEqual(entry.EntryIds.First(), entry.FieldValues.First(f => f.FieldId == 1).Value.ToString()); Assert.IsTrue(entry.FieldValues.First(f => f.FieldId == TestCharacterFieldId).Value.ToString().Contains("你好")); } } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void GetEntryList_qulifier_fieldIds_nopage_hascount_hasorder_success() { ARSession session = new ARSession(); try { int total = 0; session.Login(TestServer, TestAdmin, TestAdminPwd); List<UInt32> fieldIds = new List<UInt32>(); fieldIds.Add(TestCharacterFieldId); fieldIds.Add(TestIntFieldId); List<ARSortInfo> sortInfo = new List<ARSortInfo>(); sortInfo.Add(new ARSortInfo { FieldId = TestCharacterFieldId, Order = SortOrder.SORT_DESCENDING }); var retlist = session.GetEntryList( TestRegularFormName, "'Character Field' LIKE \"%你好%\"", fieldIds.ToArray(), null, null, ref total, sortInfo.ToArray() ); Assert.AreEqual(11, retlist.Count); Assert.AreEqual(11, total); foreach (var entry in retlist) { //Assert.AreEqual(entry.EntryIds.First(), entry.FieldValues.First(f => f.FieldId == 1).Value.ToString()); Assert.IsTrue(entry.FieldValues.First(f => f.FieldId == TestCharacterFieldId).Value.ToString().Contains("你好")); } string maxentrylist = retlist.Max(e => e.EntryIds.First()); string minentrylist = retlist.Min(e => e.EntryIds.First()); Assert.AreEqual(10, Convert.ToInt32(maxentrylist) - Convert.ToInt32(minentrylist)); Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[0].FieldValues[0].Value); Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[1].FieldValues[0].Value); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_DateTime() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List<ARFieldValue> valuelist = new List<ARFieldValue>(); //convert datetime to second from 1970-1-1 TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1); int secondtoNow = (int)ts.TotalSeconds; valuelist.Add(new ARFieldValue(TestDateTimeFieldId, secondtoNow, ARDataType.DATA_TYPE_TIME)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List<string> entryIds = new List<string>(); entryIds.Add(entryid); List<uint> fieldIds = new List<uint>(); fieldIds.Add((uint)TestDateTimeFieldId); List<ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_TIME, Entry[0].DataType); Assert.AreEqual(TestDateTimeFieldId, Entry[0].FieldId); Assert.AreEqual(secondtoNow, Entry[0].Value); //Set valuelist.Clear(); valuelist.Add(new ARFieldValue(TestDateTimeFieldId, secondtoNow+100, ARDataType.DATA_TYPE_TIME)); session.SetEntry(TestRegularFormName, entryIds.ToArray(), valuelist.ToArray()); //Get for Assert Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_TIME, Entry[0].DataType); Assert.AreEqual(TestDateTimeFieldId, Entry[0].FieldId); Assert.AreEqual(secondtoNow + 100, Entry[0].Value); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void GetEntryListStatictisc_count_noqulifier_group_success() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<UInt32> groupIds = new List<UInt32>(); groupIds.Add(TestCharacterFieldId); var retlist = session.GetListEntryStatictisc( TestRegularFormName, null, ARStatictisc.STAT_OP_COUNT, null, groupIds.ToArray() ); Assert.AreEqual(3, retlist.Count); Dictionary<String, int> assertTable = new Dictionary<string, int>(); assertTable.Add("Hello Remedy", 7); assertTable.Add("你好 RemedySet Something", 2); assertTable.Add("你好 Remedy", 9); Assert.AreEqual(assertTable[retlist[0].GroupByValues[0].ToString()], Convert.ToInt32(retlist[0].Statictisc)); Assert.AreEqual(assertTable[retlist[1].GroupByValues[0].ToString()], Convert.ToInt32(retlist[1].Statictisc)); Assert.AreEqual(assertTable[retlist[2].GroupByValues[0].ToString()], Convert.ToInt32(retlist[2].Statictisc)); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void GetEntryListStatictisc_count_qulifier_nogroup_success() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<UInt32> groupIds = new List<UInt32>(); groupIds.Add(TestCharacterFieldId); var retlist = session.GetListEntryStatictisc( TestRegularFormName, "'Character Field' = \"Hello Remedy\"", ARStatictisc.STAT_OP_COUNT, null, null ); Assert.AreEqual(1, retlist.Count); Assert.AreEqual(7, Convert.ToInt32(retlist[0].Statictisc)); Assert.AreEqual(null, retlist[0].GroupByValues); } catch (Exception ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void ARSession_Transcation_Create_Create_Success() { ARSession session = new ARSession(); try{ session.Login(TestServer, TestAdmin, TestAdminPwd); List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId,(object)TestCharacterFieldValue,ARDataType.DATA_TYPE_CHAR)); //begin Transaction session.BeginBulkEntryTransaction(); //create session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //let the second call success too //valuelist.Add(new ARFieldValue(7u, null, ARDataType.DATA_TYPE_NULL)); session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //commit var result = session.EndBulkEntryTransaction(1); Assert.IsTrue(result.Success); Assert.AreEqual(2, result.ResultList.Count); Assert.AreEqual(EntryCallType.BULK_ENTRY_CREATE, result.ResultList[0].CallType); var entryid1 = result.ResultList[0].EntryId; Assert.IsNull(result.ResultList[0].Status); Assert.AreEqual(EntryCallType.BULK_ENTRY_CREATE, result.ResultList[1].CallType); var entryid2 = result.ResultList[1].EntryId; Assert.IsNull(result.ResultList[1].Status); List<string> entryIds = new List<string>(); entryIds.Add(entryid1); List<uint> fieldIds = new List<uint>(); fieldIds.Add((uint)TestCharacterFieldId); List<ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(TestCharacterFieldValue, Entry.First(f => f.FieldId == TestCharacterFieldId).Value.ToString()); entryIds.Clear(); entryIds.Add(entryid2); List<ARFieldValue> Entry2 = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(TestCharacterFieldValue, Entry2.First(f => f.FieldId == TestCharacterFieldId).Value.ToString()); } catch(ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_datatype_Time() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); //Create List<ARFieldValue> valuelist = new List<ARFieldValue>(); DateTime dt = DateTime.Now; int secondtoNow = dt.Hour*3600 + dt.Minute*60 + dt.Second; valuelist.Add(new ARFieldValue(TestTimeFieldId, secondtoNow, ARDataType.DATA_TYPE_TIME_OF_DAY)); string entryid = session.CreateEntry(TestRegularFormName, valuelist.ToArray()); //Get for Assert List<string> entryIds = new List<string>(); entryIds.Add(entryid); List<uint> fieldIds = new List<uint>(); fieldIds.Add((uint)TestTimeFieldId); List<ARFieldValue> Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_TIME_OF_DAY, Entry[0].DataType); Assert.AreEqual(TestTimeFieldId, Entry[0].FieldId); Assert.AreEqual(secondtoNow, Entry[0].Value); //Set valuelist.Clear(); valuelist.Add(new ARFieldValue(TestTimeFieldId, secondtoNow + 100, ARDataType.DATA_TYPE_TIME_OF_DAY)); session.SetEntry(TestRegularFormName, entryIds.ToArray(), valuelist.ToArray()); //Get for Assert Entry = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, Entry.Count); Assert.AreEqual(ARDataType.DATA_TYPE_TIME_OF_DAY, Entry[0].DataType); Assert.AreEqual(TestTimeFieldId, Entry[0].FieldId); Assert.AreEqual(secondtoNow + 100, Entry[0].Value); } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void CreateEntry_form_not_found_303() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); List<ARFieldValue> valuelist = new List<ARFieldValue>(); valuelist.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValue, ARDataType.DATA_TYPE_CHAR)); session.CreateEntry(TestRegularFormName + "Y(HGYU", valuelist.ToArray()); } catch (ARException ex) { Assert.AreEqual(303, ex.MessageNumber); //183977-ErrorMsgs-7604.pdf page 49 } session.LogOut(); }
public void ARSession_Create_Entry_with_Att_01() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); /* create entry with att and get it for assert */ string testStr = "先假设这就是附件内容"; byte[] buff = Encoding.UTF8.GetBytes(testStr); List <ARFieldValue> fvl = new List <ARFieldValue>(); fvl.Add(new ARFieldValue { FieldId = attchFId, DataType = ARDataType.DATA_TYPE_ATTACH, Value = new ARAttachment { AttchmentName = "附件.txt", Buff = buff } }); fvl.Add(new ARFieldValue(TestCharacterFieldId, "Attachment Flag", ARDataType.DATA_TYPE_CHAR)); string entryId = session.CreateEntry(TestRegularFormName, fvl.ToArray()); Assert.IsNotNull(entryId); List <uint> fieldIds = new List <uint>(); fieldIds.Add(attchFId); List <string> entryIds = new List <string>(); entryIds.Add(entryId); List <ARFieldValue> arfvl = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, arfvl.Count); Assert.IsTrue(arfvl[0].Value is ARAttachment); ARAttachment att = (ARAttachment)arfvl[0].Value; String rStr = Encoding.UTF8.GetString(att.Buff); Assert.AreEqual( testStr, rStr); byte[] setByte = Encoding.UTF8.GetBytes(testStr + " after set."); List <ARFieldValue> set_arfvl = new List <ARFieldValue>(); set_arfvl.Add(new ARFieldValue { DataType = ARDataType.DATA_TYPE_ATTACH, FieldId = attchFId, Value = new ARAttachment { AttchmentName = "ARSession_Create_Entry_with_Att_01.txt", Buff = setByte } }); session.SetEntry(TestRegularFormName, entryIds.ToArray(), set_arfvl.ToArray()); /* Get blob from the entry */ byte[] buffer = session.GetBLOB(TestRegularFormName, entryIds.ToArray(), attchFId); String rStr2 = Encoding.UTF8.GetString(buffer); Assert.AreEqual( testStr + " after set.", rStr2); /* Get entry list */ int total = -1; var listEntry = session.GetEntryList(TestRegularFormName, "'Character Field' = \"Attachment Flag\"" , fieldIds.ToArray(), null, null, ref total, null); foreach (var l in listEntry) { Assert.IsTrue(l.FieldValues[0].Value is ARAttachment); ARAttachment att2 = (ARAttachment)l.FieldValues[0].Value; String rStr3 = Encoding.UTF8.GetString(att2.Buff); Assert.AreEqual( testStr + " after set.", rStr3); } } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }
public void ARSession_Create_Entry_with_Att_01() { ARSession session = new ARSession(); try { session.Login(TestServer, TestAdmin, TestAdminPwd); /* create entry with att and get it for assert */ string testStr = "先假设这就是附件内容"; byte[] buff = Encoding.UTF8.GetBytes(testStr); List<ARFieldValue> fvl = new List<ARFieldValue>(); fvl.Add(new ARFieldValue { FieldId = attchFId, DataType = ARDataType.DATA_TYPE_ATTACH, Value = new ARAttachment { AttchmentName = "附件.txt", Buff = buff } }); fvl.Add(new ARFieldValue(TestCharacterFieldId, "Attachment Flag", ARDataType.DATA_TYPE_CHAR)); string entryId = session.CreateEntry(TestRegularFormName, fvl.ToArray()); Assert.IsNotNull(entryId); List<uint> fieldIds = new List<uint>(); fieldIds.Add(attchFId); List<string> entryIds = new List<string>(); entryIds.Add(entryId); List<ARFieldValue> arfvl = session.GetEntry(TestRegularFormName, entryIds.ToArray(), fieldIds.ToArray()); Assert.AreEqual(1, arfvl.Count); Assert.IsTrue(arfvl[0].Value is ARAttachment); ARAttachment att = (ARAttachment)arfvl[0].Value; String rStr = Encoding.UTF8.GetString(att.Buff); Assert.AreEqual( testStr, rStr); byte[] setByte = Encoding.UTF8.GetBytes(testStr + " after set."); List<ARFieldValue> set_arfvl = new List<ARFieldValue>(); set_arfvl.Add(new ARFieldValue{ DataType = ARDataType.DATA_TYPE_ATTACH, FieldId = attchFId, Value = new ARAttachment { AttchmentName = "ARSession_Create_Entry_with_Att_01.txt", Buff = setByte } }); session.SetEntry(TestRegularFormName, entryIds.ToArray(), set_arfvl.ToArray()); /* Get blob from the entry */ byte[] buffer = session.GetBLOB(TestRegularFormName, entryIds.ToArray(), attchFId); String rStr2 = Encoding.UTF8.GetString(buffer); Assert.AreEqual( testStr + " after set.", rStr2); /* Get entry list */ int total = -1; var listEntry = session.GetEntryList(TestRegularFormName, "'Character Field' = \"Attachment Flag\"" , fieldIds.ToArray(), null, null, ref total, null); foreach (var l in listEntry) { Assert.IsTrue(l.FieldValues[0].Value is ARAttachment); ARAttachment att2 = (ARAttachment)l.FieldValues[0].Value; String rStr3 = Encoding.UTF8.GetString(att2.Buff); Assert.AreEqual( testStr + " after set.", rStr3); } } catch (ARException ex) { Assert.AreEqual(null, ex); } session.LogOut(); }