Esempio n. 1
0
        public static void Initialize(TestContext context2)
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                //int totalMatch = -1;
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                var models = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    null,
                    0,
                    null,
                    null);
                foreach (var model in models)
                {
                    proxy.DeleteEntry(model);
                }

                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField     = TestCharacterFieldValue;
                newentry.Radio_Button_Field = null;
                newentry.IntegerField       = 1;
                for (int i = 0; i < 7; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese;
                newentry.IntegerField   = 2;
                for (int i = 0; i < 9; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese + "Set Something";
                newentry.IntegerField   = 3;
                for (int i = 0; i < 2; i++)
                {
                    proxy.CreateEntry(newentry);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("env init in Construct error.", ex);
            }
            finally
            {
                context.Dispose();
            }
        }
        public static void Initialize(TestContext context2)
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                //int totalMatch = -1;
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var models = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    null,
                    0,
                    null,
                    null);
                foreach (var model in models)
                {
                    proxy.DeleteEntry(model);
                }

                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField = TestCharacterFieldValue;
                newentry.Radio_Button_Field = null;
                newentry.IntegerField = 1;
                for (int i = 0; i < 7; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese;
                newentry.IntegerField = 2;
                for (int i = 0; i < 9; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese + "Set Something";
                newentry.IntegerField = 3;
                for (int i = 0; i < 2; i++)
                {
                    proxy.CreateEntry(newentry);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("env init in Construct error.", ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 3
0
        public void SetEntries_All()
        {
            ARLoginContext context = null;

            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);

                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField     = TestCharacterFieldValue;
                newentry.Radio_Button_Field = null;
                newentry.IntegerField       = 1;
                for (int i = 0; i < 7; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese;
                newentry.IntegerField   = 2;
                for (int i = 0; i < 9; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                ARSet <NRemedy_Test_Regular_Form> set = new ARSet <NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        select s.IntegerField;

                int count = q.Count();
                Assert.IsTrue(count > 0);

                NRemedy_Test_Regular_Form model = new NRemedy_Test_Regular_Form();
                model.IntegerField = 110;//original is 1

                proxy.SetEntryList(null, model, new string[] { "IntegerField" });

                //after delete the count should be 0
                foreach (var i in q)
                {
                    Assert.AreEqual(110, i);
                }
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }
        }
Esempio n. 4
0
        public void ARProxy_CreateEntry_datatype_int()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    IntegerField   = 256
                });
                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(256, model.IntegerField);

                model.IntegerField = 512;
                proxy.SetEntry(model);

                Assert.AreEqual(512, model.IntegerField);
                Assert.AreEqual("should not changed", model.CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 5
0
        public void ARProxy_CreateEntry_datatype_Enum()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                DateTime dt      = DateTime.Now;
                string   entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status         = NRemedy_Test_Regular_Form.Status_Enum.Fixed
                });
                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);

                model.Status = NRemedy_Test_Regular_Form.Status_Enum.Rejected;
                proxy.SetEntry(model);

                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Rejected, model.Status);

                //Assert.AreEqual(dt + new TimeSpan(1, 1, 1), model.DateTimeField);
                Assert.AreEqual("should not changed", model.CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 6
0
        public void ARProxy_CreateEntry_from_delegation()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                DateTime dt      = DateTime.Now;
                string   entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status         = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                },
                                                     //define a delegate only save status
                                                     delegate(System.Reflection.PropertyInfo pi)
                {
                    return(pi.Name == "Status");
                }
                                                     );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                Assert.AreEqual(null, null);//
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 7
0
        public void ARProxy_DeleteEntry_By_EntryId()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                DateTime dt      = DateTime.Now;
                string   entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status         = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                }
                                                     );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);

                //delete
                proxy.DeleteEntry(entryId);
                NRemedy_Test_Regular_Form model2 = proxy.GetEntry(entryId);
                Assert.IsNull(model2);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 8
0
        public void ARProxy_CreateEntry_simple_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                //create a generic type proxy to perform API
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                //simply use a model instance to create an entry
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form {
                    CharacterField = TestCharacterFieldValue
                });
                Assert.AreNotEqual(null, entryId);
                //also use a entryid(request id) to get entry from AR
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(TestCharacterFieldValue, model.CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
        public void DeleteEntries_constant_condition_true()
        {
            ARLoginContext context = null;

            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);

                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField     = TestCharacterFieldValue;
                newentry.Radio_Button_Field = null;
                newentry.IntegerField       = 1;
                for (int i = 0; i < 7; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese;
                newentry.IntegerField   = 2;
                for (int i = 0; i < 9; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                ARSet <NRemedy_Test_Regular_Form> set = new ARSet <NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        select s.RequestID;
                int count = q.Count();
                Assert.IsTrue(count > 0);

                proxy.DeleteEntryList(null);

                //after delete the count should be 0
                Assert.AreEqual(0, q.Count());
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }
        }
Esempio n. 10
0
 public void ARProxy_Create_Entry_JoinForm_No_Assert()
 {
     using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
     {
         ARProxy <NRemedy_Test_Join_Form> proxy = new ARProxy <NRemedy_Test_Join_Form>(context);
         string entryid = proxy.CreateEntry(new NRemedy_Test_Join_Form {
             GUID              = Guid.NewGuid().ToString(),
             ShortDescription  = "shortdescription1",
             ShortDescription2 = "shortdescription2",
             CharacterField    = "CharacterField",
             CharacterField2   = "CharacterField2"
         });
     }
 }
Esempio n. 11
0
 public void ARProxy_Create_Entry_JoinForm_No_Assert()
 {
     using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
     {
         ARProxy<NRemedy_Test_Join_Form> proxy = new ARProxy<NRemedy_Test_Join_Form>(context);
         string entryid = proxy.CreateEntry(new NRemedy_Test_Join_Form {
             GUID = Guid.NewGuid().ToString(),
             ShortDescription = "shortdescription1",
             ShortDescription2 = "shortdescription2",
             CharacterField = "CharacterField",
             CharacterField2 = "CharacterField2"
         });
     }
 }
Esempio n. 12
0
        public void ARProxy_SetEntry_By_Properties_Ids()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                DateTime dt      = DateTime.Now;
                string   entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField     = "should not changed",
                    Status             = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    DecimalNumberField = 3.13m,
                    IntegerField       = 10
                }
                                                     );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                //Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                model.CharacterField     = "don not want changed";
                model.Status             = NRemedy_Test_Regular_Form.Status_Enum.New;
                model.DecimalNumberField = 3.14m;
                model.IntegerField       = 11;

                List <ARFieldValue> up_fvs = new List <ARFieldValue>();

                up_fvs.Add(new ARFieldValue(TestDecimalFieldId, 3.14m, ARDataType.DATA_TYPE_DECIMAL));
                up_fvs.Add(new ARFieldValue(7u, NRemedy_Test_Regular_Form.Status_Enum.New, ARDataType.DATA_TYPE_ENUM));
                up_fvs.Add(new ARFieldValue(TestIntFieldId, 11, ARDataType.DATA_TYPE_INTEGER));

                //set
                proxy.SetEntry(entryId, up_fvs);

                NRemedy_Test_Regular_Form model2 = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.New, model2.Status);
                Assert.AreEqual(3.14m, model2.DecimalNumberField);
                Assert.AreEqual(11, model2.IntegerField);
                Assert.AreEqual("should not changed", model2.CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
        public void SetEntries_All()
        {
            ARLoginContext context = null;
            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);

                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField = TestCharacterFieldValue;
                newentry.Radio_Button_Field = null;
                newentry.IntegerField = 1;
                for (int i = 0; i < 7; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese;
                newentry.IntegerField = 2;
                for (int i = 0; i < 9; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        select s.IntegerField;

                int count = q.Count();
                Assert.IsTrue(count > 0);

                NRemedy_Test_Regular_Form model = new NRemedy_Test_Regular_Form();
                model.IntegerField = 110;//original is 1

                proxy.SetEntryList(null,model,new string[] { "IntegerField" });

                //after delete the count should be 0
                foreach(var i in q)
                {
                    Assert.AreEqual(110, i);
                }
            }
            finally
            {
                if (context != null)
                    context.Dispose();
            }
        }
Esempio n. 14
0
        public void ARProxy_Transacation_Simple_Rollback()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                context.TransactionBegin();
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status         = NRemedy_Test_Regular_Form.Status_Enum.Fixed
                });
                Assert.AreEqual(string.Empty, entryId);
                //second call will failed
                List <ARFieldValue> up_fvs = new List <ARFieldValue>();
                up_fvs.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR));
                proxy.SetEntry("11111111111", up_fvs);

                var result = context.TransactionCommit();

                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;
                //!!@@important
                //when create entry is not in trasaction, it will not cause warning 52 when the RequestID is in the fieldValueList
                //but in trasacation, this will cause warning 52.
                //this because trasaction actually means group the operations and send to AR when commit.AR may block the operaion,
                //even this is caused by warning
                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 (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 15
0
        public void ARProxy_SetEntry_By_Properties_Str()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                DateTime dt      = DateTime.Now;
                string   entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField     = "should not changed",
                    Status             = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    DecimalNumberField = 3.13m,
                    IntegerField       = 10
                }
                                                     );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                //Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                model.CharacterField     = "don not want changed";
                model.Status             = NRemedy_Test_Regular_Form.Status_Enum.New;
                model.DecimalNumberField = 3.14m;
                model.IntegerField       = 11;

                //set
                proxy.SetEntry(model, new string[] {
                    "Status",
                    "DecimalNumberField",
                    "IntegerField"
                });

                NRemedy_Test_Regular_Form model2 = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.New, model2.Status);
                Assert.AreEqual(3.14m, model2.DecimalNumberField);
                Assert.AreEqual(11, model2.IntegerField);
                Assert.AreEqual("should not changed", model2.CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 16
0
        public void ARProxy_CreateEntry_datatype_datetime()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                DateTime dt      = DateTime.Now;
                string   entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    DateTimeField  = dt
                });
                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);

                Assert.AreEqual(dt.Year, ((DateTime)model.DateTimeField).Year);
                Assert.AreEqual(dt.Month, ((DateTime)model.DateTimeField).Month);
                Assert.AreEqual(dt.Day, ((DateTime)model.DateTimeField).Day);
                Assert.AreEqual(dt.Hour, ((DateTime)model.DateTimeField).Hour);
                Assert.AreEqual(dt.Minute, ((DateTime)model.DateTimeField).Minute);
                Assert.AreEqual(dt.Second, ((DateTime)model.DateTimeField).Second);

                model.DateTimeField = dt + new TimeSpan(1, 1, 1);
                proxy.SetEntry(model);

                Assert.AreEqual(dt.Year, ((DateTime)model.DateTimeField).Year);
                Assert.AreEqual(dt.Month, ((DateTime)model.DateTimeField).Month);
                Assert.AreEqual(dt.Day, ((DateTime)model.DateTimeField).Day);
                Assert.AreEqual(dt.Hour + 1, ((DateTime)model.DateTimeField).Hour);
                Assert.AreEqual(dt.Minute + 1, ((DateTime)model.DateTimeField).Minute);
                //the second may error in some case
                Assert.AreEqual(dt.Second + 1, ((DateTime)model.DateTimeField).Second);

                //Assert.AreEqual(dt + new TimeSpan(1, 1, 1), model.DateTimeField);
                Assert.AreEqual("should not changed", model.CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
        public void DeleteEntries_constant_condition_true()
        {
            ARLoginContext context = null;
            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);

                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField = TestCharacterFieldValue;
                newentry.Radio_Button_Field = null;
                newentry.IntegerField = 1;
                for (int i = 0; i < 7; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                newentry.CharacterField = TestCharacterFieldValueChinese;
                newentry.IntegerField = 2;
                for (int i = 0; i < 9; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        select s.RequestID;
                int count = q.Count();
                Assert.IsTrue(count > 0);

                proxy.DeleteEntryList(null);

                //after delete the count should be 0
                Assert.AreEqual(0, q.Count());
            }
            finally
            {
                if (context != null)
                    context.Dispose();
            }
        }
Esempio n. 18
0
        public void ARProxy_GetEntry_JoinForm()
        {
            List <Guid> guid = new List <Guid>();

            for (int i = 0; i < 10; i++)
            {
                guid.Add(Guid.NewGuid());
            }

            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                ARProxy <NRemedy_Test_Join_Form> proxy = new ARProxy <NRemedy_Test_Join_Form>(context);
                foreach (var g in guid)
                {
                    proxy.CreateEntry(new NRemedy_Test_Join_Form
                    {
                        GUID              = g.ToString(),
                        ShortDescription  = "shortdescription1",
                        ShortDescription2 = "shortdescription2",
                        CharacterField    = "CharacterField",
                        CharacterField2   = "CharacterField2"
                    });
                }

                ARSet <NRemedy_Test_Join_Form> set = new ARSet <NRemedy_Test_Join_Form>(context);

                foreach (var g in guid)
                {
                    var q = from s in set
                            where s.GUID == g.ToString()
                            select s;

                    foreach (var r in q)
                    {
                        Assert.AreEqual(g.ToString(), r.GUID);
                    }
                }
            }
        }
Esempio n. 19
0
        public void ARProxy_CreateEntry_datatype_character_chinese_with_set()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = TestCharacterFieldValueChinese,
                    IntegerField   = 3
                });
                Assert.AreNotEqual(null, entryId);

                //GetEntry
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(TestCharacterFieldValueChinese, model.CharacterField);
                model.CharacterField = TestCharacterFieldValueChinese + "Set Something";

                //SetEntry
                proxy.SetEntry(model);
                model = null;

                //GetAgain
                model = proxy.GetEntry(entryId);
                Assert.IsNotNull(model);
                Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", model.CharacterField);
                Assert.AreEqual(3, model.IntegerField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 20
0
        public void ARProxy_Create_Entry_with_Att_01()
        {
            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                string testStr = "This is test string , which will be save as file and create entry into AR. The Test method is ARProxy_Create_Entry_with_Att_01";

                byte[] buff = Encoding.UTF8.GetBytes(testStr);

                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    Attachment = new ARAttachment {
                        AttchmentName = "ARProxy_Create_Entry_with_Att_01.txt",
                        Buff          = buff
                    }
                });


                NRemedy_Test_Regular_Form entry = proxy.GetEntry(entryId);

                entry.Attachment.AttchmentName = "ARProxy_Create_Entry_with_Att_01.txt";
                Assert.AreEqual(testStr, Encoding.UTF8.GetString(entry.Attachment.Buff));



                List <UInt32> attchFIds = new List <uint>();
                attchFIds.Add(attchFId);
                //int total = -1;
                IList <NRemedy_Test_Regular_Form> entries = proxy.GetEntryList(null, attchFIds, 0, null, null, null);
                foreach (var e in entries)
                {
                    if (e.Attachment != null && e.Attachment.AttchmentName == "ARProxy_Create_Entry_with_Att_01.txt")
                    {
                        Assert.AreEqual(testStr, Encoding.UTF8.GetString(e.Attachment.Buff));
                    }
                }
            }
        }
Esempio n. 21
0
        public void ARProxy_GetEntryStatictisc_JoinForm()
        {
            List<Guid> guid = new List<Guid>();
            for (int i = 0; i < 10; i++)
            {
                guid.Add(Guid.NewGuid());

            }

            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                ARProxy<NRemedy_Test_Join_Form> proxy = new ARProxy<NRemedy_Test_Join_Form>(context);
                foreach (var g in guid)
                {
                    proxy.CreateEntry(new NRemedy_Test_Join_Form
                    {
                        GUID = g.ToString(),
                        ShortDescription = "shortdescription1",
                        ShortDescription2 = "shortdescription2",
                        CharacterField = "CharacterField",
                        CharacterField2 = "CharacterField2"
                    });
                }

                ARSet<NRemedy_Test_Join_Form> set = new ARSet<NRemedy_Test_Join_Form>(context);

                foreach (var g in guid)
                {
                    var q = from s in set
                            where s.GUID == g.ToString()
                            select s;

                    Assert.AreEqual(1, q.Count());
                }

            }
        }
Esempio n. 22
0
        public void ARProxy_Create_Entry_with_Att_01()
        {
            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {

                string testStr = "This is test string , which will be save as file and create entry into AR. The Test method is ARProxy_Create_Entry_with_Att_01";

                byte[] buff = Encoding.UTF8.GetBytes(testStr);

                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    Attachment = new ARAttachment {
                        AttchmentName = "ARProxy_Create_Entry_with_Att_01.txt",
                        Buff = buff
                    }
                });

                NRemedy_Test_Regular_Form entry = proxy.GetEntry(entryId);

                entry.Attachment.AttchmentName = "ARProxy_Create_Entry_with_Att_01.txt";
                Assert.AreEqual(testStr, Encoding.UTF8.GetString(entry.Attachment.Buff));

                List<UInt32> attchFIds = new List<uint>();
                attchFIds.Add(attchFId);
                //int total = -1;
                IList<NRemedy_Test_Regular_Form> entries = proxy.GetEntryList(null, attchFIds, 0, null, null, null);
                foreach (var e in entries)
                {
                    if (e.Attachment != null && e.Attachment.AttchmentName == "ARProxy_Create_Entry_with_Att_01.txt")
                    {
                        Assert.AreEqual(testStr, Encoding.UTF8.GetString(e.Attachment.Buff));
                    }
                }

            }
        }
Esempio n. 23
0
        public void ARProxy_GetEntry_By_Properties_Ids()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy = new ARProxy <NRemedy_Test_Regular_Form>(context);
                DateTime dt      = DateTime.Now;
                string   entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField     = "should not changed",
                    Status             = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    DecimalNumberField = 3.14m,
                    IntegerField       = 10
                }
                                                     );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId, new List <uint> {
                    7u,
                    TestDecimalFieldId
                });

                Assert.IsNull(model.CharacterField);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                Assert.AreEqual(3.14m, model.DecimalNumberField);
                Assert.AreEqual(null, model.IntegerField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
        public void GetEntry_by_Expression_single_condition()
        {
            ARLoginContext context = null;
            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);

                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    DecimalNumberField = 3.13m,
                    IntegerField = 10
                }
                );

                Assert.AreNotEqual(null, entryId);

                NRemedy_Test_Regular_Form entry = proxy.GetEntry(entryId,
                    m => m.CharacterField,
                    m => m.Status,
                    m => m.DecimalNumberField
                    );

                Assert.AreEqual("should not changed", entry.CharacterField);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, entry.Status);
                Assert.AreEqual(3.13m, entry.DecimalNumberField);
                Assert.AreEqual(null, entry.IntegerField);

            }
            finally {
                if (context != null)
                    context.Dispose();
            }
        }
Esempio n. 25
0
        public void ARProxy_CreateEntry_datatype_character_chinese_with_delete()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = TestCharacterFieldValueChinese
                });
                Assert.AreNotEqual(null, entryId);

                //GetEntry
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(TestCharacterFieldValueChinese,  model.CharacterField);

                //DeleteEntry
                proxy.DeleteEntry(model);

                //GetAgain
                model = proxy.GetEntry(entryId);
                Assert.IsNull(model);

                //DeleteAgain
                proxy.DeleteEntry(entryId);
            }
            catch (ARException ex)
            {
                Assert.AreEqual(null, ex);

            }
            finally
            {
                context.Dispose();
            }
        }
        public void GetEntry_by_Expression_single_condition()
        {
            ARLoginContext context = null;
            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    DecimalNumberField = 3.13m,
                    IntegerField = 10
                }
                );

                Assert.AreNotEqual(null, entryId);

                NRemedy_Test_Regular_Form entry = proxy.GetEntry(entryId,
                    m => m.CharacterField,
                    m => m.Status,
                    m => m.DecimalNumberField
                    );

                Assert.AreEqual("should not changed", entry.CharacterField);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, entry.Status);
                Assert.AreEqual(3.13m, entry.DecimalNumberField);
                Assert.AreEqual(null, entry.IntegerField);

            }
            finally {
                if (context != null)
                    context.Dispose();
            }
        }
Esempio n. 27
0
        public void ARProxy_CreateEntry_datatype_int()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    IntegerField = 256
                });
                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(256, model.IntegerField);

                model.IntegerField = 512;
                proxy.SetEntry(model);

                Assert.AreEqual(512, model.IntegerField);
                Assert.AreEqual("should not changed", model.CharacterField);

            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 28
0
        public void ARProxy_CreateEntry_datatype_Real()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                DateTime dt = DateTime.Now;
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    RealNumberField = 3.14
                });
                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(3.14, model.RealNumberField);

                model.RealNumberField = 0.62;
                proxy.SetEntry(model);

                Assert.AreEqual(0.62, model.RealNumberField);

                //Assert.AreEqual(dt + new TimeSpan(1, 1, 1), model.DateTimeField);
                Assert.AreEqual("should not changed", model.CharacterField);

            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 29
0
        public void ARProxy_CreateEntry_from_delegation()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                DateTime dt = DateTime.Now;
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                },
                //define a delegate only save status
                delegate(System.Reflection.PropertyInfo pi)
                {
                    return pi.Name == "Status";
                }
                );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                Assert.AreEqual(null, null);//
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 30
0
 public void ARProxy_CreateEntry_simple_success()
 {
     ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
     try
     {
         //create a generic type proxy to perform API
         ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
         //simply use a model instance to create an entry
         string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form {
             CharacterField = TestCharacterFieldValue
         });
         Assert.AreNotEqual(null, entryId);
         //also use a entryid(request id) to get entry from AR
         NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
         Assert.AreEqual(TestCharacterFieldValue, model.CharacterField);
     }
     catch (Exception ex)
     {
         Assert.AreEqual(null, ex);
     }
     finally
     {
         context.Dispose();
     }
 }
Esempio n. 31
0
        public void ARProxy_CreateEntry_datatype_Enum_NULL()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                DateTime dt = DateTime.Now;
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    Radio_Button_Field = null//
                });
                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                Assert.AreEqual(null, model.RealNumberField);//

                model.Status = NRemedy_Test_Regular_Form.Status_Enum.Rejected;
                model.Radio_Button_Field = NRemedy_Test_Regular_Form.Radio_Button_Field_Enum.First;//
                proxy.SetEntry(model);

                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Rejected, model.Status);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Radio_Button_Field_Enum.First, model.Radio_Button_Field);//
                //Assert.AreEqual(dt + new TimeSpan(1, 1, 1), model.DateTimeField);
                Assert.AreEqual("should not changed", model.CharacterField);

            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 32
0
        public void ARProxy_GetEntry_By_Properties_Ids()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                DateTime dt = DateTime.Now;
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    DecimalNumberField = 3.14m,
                    IntegerField = 10
                }
                );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId, new List<uint>{
                    7u,
                    TestDecimalFieldId
                });

                Assert.IsNull(model.CharacterField);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                Assert.AreEqual(3.14m, model.DecimalNumberField);
                Assert.AreEqual(null, model.IntegerField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 33
0
        public void ARProxy_SetEntry_By_Properties_Ids()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                DateTime dt = DateTime.Now;
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    DecimalNumberField = 3.13m,
                    IntegerField = 10
                }
                );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                //Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                model.CharacterField = "don not want changed";
                model.Status = NRemedy_Test_Regular_Form.Status_Enum.New;
                model.DecimalNumberField = 3.14m;
                model.IntegerField = 11;

                List<ARFieldValue> up_fvs = new List<ARFieldValue>();

                up_fvs.Add(new ARFieldValue(TestDecimalFieldId, 3.14m, ARDataType.DATA_TYPE_DECIMAL));
                up_fvs.Add(new ARFieldValue(7u, NRemedy_Test_Regular_Form.Status_Enum.New, ARDataType.DATA_TYPE_ENUM));
                up_fvs.Add(new ARFieldValue(TestIntFieldId, 11, ARDataType.DATA_TYPE_INTEGER));

                //set
                proxy.SetEntry(entryId, up_fvs);

                NRemedy_Test_Regular_Form model2 = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.New, model2.Status);
                Assert.AreEqual(3.14m, model2.DecimalNumberField);
                Assert.AreEqual(11, model2.IntegerField);
                Assert.AreEqual("should not changed", model2.CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 34
0
        public void ARProxy_SetEntry_By_Properties_Str()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                DateTime dt = DateTime.Now;
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                    DecimalNumberField = 3.13m,
                    IntegerField = 10
                }
                );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                //Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);
                model.CharacterField = "don not want changed";
                model.Status = NRemedy_Test_Regular_Form.Status_Enum.New;
                model.DecimalNumberField = 3.14m;
                model.IntegerField = 11;

                //set
                proxy.SetEntry(model, new string[] {
                    "Status",
                    "DecimalNumberField",
                    "IntegerField"
                });

                NRemedy_Test_Regular_Form model2 = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.New, model2.Status);
                Assert.AreEqual(3.14m, model2.DecimalNumberField);
                Assert.AreEqual(11, model2.IntegerField);
                Assert.AreEqual("should not changed", model2.CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 35
0
        public void ARProxy_Transacation_Simple_Rollback()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                context.TransactionBegin();
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed
                });
                Assert.AreEqual(string.Empty, entryId);
                //second call will failed
                List<ARFieldValue> up_fvs = new List<ARFieldValue>();
                up_fvs.Add(new ARFieldValue(TestCharacterFieldId, (object)TestCharacterFieldValueChinese, ARDataType.DATA_TYPE_CHAR));
                proxy.SetEntry("11111111111", up_fvs);

                var result = context.TransactionCommit();

                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;
                //!!@@important
                //when create entry is not in trasaction, it will not cause warning 52 when the RequestID is in the fieldValueList
                //but in trasacation, this will cause warning 52.
                //this because trasaction actually means group the operations and send to AR when commit.AR may block the operaion,
                //even this is caused by warning
                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 (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 36
0
        public void ARProxy_GetListEntry_MaxEntries_Cover_notCover()
        {
            Clean();
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);

            try
            {
                ARProxy <NRemedy_Test_Regular_Form> proxy    = new ARProxy <NRemedy_Test_Regular_Form>(context);
                NRemedy_Test_Regular_Form           newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField = TestCharacterFieldValue;
                newentry.IntegerField   = 1;
                for (int i = 0; i < 588; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                var results = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    null,
                    0,
                    null,
                    null);
                Assert.AreEqual(588, results.Count);


                var results2 = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    300,
                    10,
                    null,
                    null);
                Assert.AreEqual(300, results2.Count);

                var results3 = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    100,
                    10,
                    null,
                    null);
                Assert.AreEqual(100, results3.Count);

                for (int i = 0; i < 100; i++)
                {
                    Assert.AreEqual(results3[i].RequestID, results2[i].RequestID);
                }


                var results4 = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    200,
                    400,
                    null,
                    null);
                Assert.AreEqual(188, results4.Count);

                var results5 = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    null,
                    400,
                    null,
                    null);
                Assert.AreEqual(188, results5.Count);
            }
            catch (Exception ex)
            {
                throw new Exception("env init in Construct error.", ex);
            }
            finally
            {
                context.Dispose();
            }
        }
        public void ARProxy_GetListEntry_MaxEntries_Cover_notCover()
        {
            Clean();
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                NRemedy_Test_Regular_Form newentry = new NRemedy_Test_Regular_Form();
                newentry.CharacterField = TestCharacterFieldValue;
                newentry.IntegerField = 1;
                for (int i = 0; i < 588; i++)
                {
                    proxy.CreateEntry(newentry);
                }

                var results = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    null,
                    0,
                    null,
                    null);
                Assert.AreEqual(588, results.Count);

                var results2 = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    300,
                    10,
                    null,
                    null);
                Assert.AreEqual(300, results2.Count);

                var results3 = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    100,
                    10,
                    null,
                    null);
                Assert.AreEqual(100, results3.Count);

                for (int i = 0; i < 100; i++)
                {
                    Assert.AreEqual(results3[i].RequestID, results2[i].RequestID);

                }

                var results4 = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    200,
                    400,
                    null,
                    null);
                Assert.AreEqual(188, results4.Count);

                var results5 = proxy.GetEntryList(
                    null,
                    new string[] { "RequestID" },
                    null,
                    400,
                    null,
                    null);
                Assert.AreEqual(188, results5.Count);

            }
            catch (Exception ex)
            {
                throw new Exception("env init in Construct error.", ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 38
0
        public void ARProxy_CreateEntry_datatype_datetime()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                DateTime dt = DateTime.Now;
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    DateTimeField = dt
                });
                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);

                Assert.AreEqual(dt.Year, ((DateTime)model.DateTimeField).Year);
                Assert.AreEqual(dt.Month, ((DateTime)model.DateTimeField).Month);
                Assert.AreEqual(dt.Day, ((DateTime)model.DateTimeField).Day);
                Assert.AreEqual(dt.Hour, ((DateTime)model.DateTimeField).Hour);
                Assert.AreEqual(dt.Minute, ((DateTime)model.DateTimeField).Minute);
                Assert.AreEqual(dt.Second, ((DateTime)model.DateTimeField).Second);

                model.DateTimeField = dt + new TimeSpan(1, 1, 1);
                proxy.SetEntry(model);

                Assert.AreEqual(dt.Year, ((DateTime)model.DateTimeField).Year);
                Assert.AreEqual(dt.Month, ((DateTime)model.DateTimeField).Month);
                Assert.AreEqual(dt.Day, ((DateTime)model.DateTimeField).Day);
                Assert.AreEqual(dt.Hour + 1, ((DateTime)model.DateTimeField).Hour);
                Assert.AreEqual(dt.Minute + 1, ((DateTime)model.DateTimeField).Minute);
                //the second may error in some case
                Assert.AreEqual(dt.Second + 1, ((DateTime)model.DateTimeField).Second);

                //Assert.AreEqual(dt + new TimeSpan(1, 1, 1), model.DateTimeField);
                Assert.AreEqual("should not changed", model.CharacterField);

            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
Esempio n. 39
0
        public void ARProxy_DeleteEntry_By_EntryId()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                DateTime dt = DateTime.Now;
                string entryId = proxy.CreateEntry(new NRemedy_Test_Regular_Form
                {
                    CharacterField = "should not changed",
                    Status = NRemedy_Test_Regular_Form.Status_Enum.Fixed,
                }
                );

                Assert.AreNotEqual(null, entryId);
                NRemedy_Test_Regular_Form model = proxy.GetEntry(entryId);
                Assert.AreEqual(NRemedy_Test_Regular_Form.Status_Enum.Fixed, model.Status);

                //delete
                proxy.DeleteEntry(entryId);
                NRemedy_Test_Regular_Form model2 = proxy.GetEntry(entryId);
                Assert.IsNull(model2);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }