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();
            }
        }
Beispiel #2
0
        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();
            }
        }
Beispiel #3
0
        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();
            }
        }
Beispiel #4
0
        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 CreateEntry_datatype_character_chinese_with_delete()
        {
            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());

                //DeleteEntry
                session.DeleteEntry(TestRegularFormName, IdList.ToArray());

                //GetAgain
                fieldsReturns.Clear();
                fieldsReturns = session.GetEntry(TestRegularFormName, IdList.ToArray(), FIdList.ToArray());
                Assert.IsNull(fieldsReturns);

                //DeleteAgain
                session.DeleteEntry(TestRegularFormName, IdList.ToArray());

            }
            catch (ARException ex)
            {
                Assert.AreEqual(null, ex);

            }
            session.LogOut();
        }
Beispiel #6
0
        public void CreateEntry_datatype_character_chinese_with_delete()
        {
            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());

                //DeleteEntry
                session.DeleteEntry(TestRegularFormName, IdList.ToArray());

                //GetAgain
                fieldsReturns.Clear();
                fieldsReturns = session.GetEntry(TestRegularFormName, IdList.ToArray(), FIdList.ToArray());
                Assert.IsNull(fieldsReturns);

                //DeleteAgain
                session.DeleteEntry(TestRegularFormName, IdList.ToArray());
            }
            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 ARSession_Transcation_Create_Delete_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
                //let the second call failed
                session.DeleteEntry(TestRegularFormName, entryid.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_DELETE, 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 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();
     }
 }
Beispiel #10
0
 public void DeleteEntry(string form, string entryId, int deleteOption = 0)
 {
     CheckSessionNull();
     SessionInstance.DeleteEntry(form, entryId.Split('|'));
 }
        public void ARSession_Transcation_Create_Delete_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
                //let the second call failed
                session.DeleteEntry(TestRegularFormName, entryid.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_DELETE, 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();
        }