コード例 #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);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("env init in Construct error.", ex);
     }
     finally
     {
         context.Dispose();
     }
 }
コード例 #2
0
        public void ARProxy_GetEntryListStatictisc_avg_qulifier_group_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                List<UInt32> groupIds = new List<UInt32>();
                groupIds.Add(TestCharacterFieldId);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var retlist = proxy.GetListEntryStatictisc(
                    "'Character Field' LIKE \"%你好%\"",
                    ARStatictisc.STAT_OP_AVERAGE,
                    TestIntFieldId,
                    groupIds
                    );
                Assert.AreEqual(2, retlist.Count);
                Dictionary<String, int> assertTable = new Dictionary<string, int>();
                //assertTable.Add("Hello Remedy", 7);
                assertTable.Add("你好 RemedySet Something", 3);
                assertTable.Add("你好 Remedy", 2);

                Assert.AreEqual(assertTable[retlist[0].CharacterField], Convert.ToInt32(retlist[0].Statictisc));
                Assert.AreEqual(assertTable[retlist[1].CharacterField], Convert.ToInt32(retlist[1].Statictisc));

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

            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #3
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();
            }
        }
コード例 #4
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"
         });
     }
 }
コード例 #5
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();
            }
        }
コード例 #6
0
        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();
            }
        }
コード例 #7
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);
                    }
                }

            }
        }
コード例 #8
0
        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();
            }
        }
コード例 #9
0
        public void GetEntryList_by_expression_qulifier_fieldIds_haspage_hascount_noorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                TotalMatch total = new TotalMatch();
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var retlist = proxy.GetEntryList(
                    m => m.CharacterField.Contains("%你好%"),
                    0,
                    5,
                    total,
                    null,
                     m => m.CharacterField,
                     m => m.RequestID
                    );
                Assert.AreEqual(5, retlist.Count);
                Assert.AreEqual(11, total.Value);
                foreach (var entry in retlist)
                {
                    Assert.AreEqual(true, entry.CharacterField.Contains("你好"));
                }

                Assert.AreEqual(4, Convert.ToInt32(retlist.Max(m => m.RequestID)) - Convert.ToInt32(retlist.Min(m => m.RequestID)));

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

            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #10
0
        public void DeleteEntries_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);
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        where s.CharacterField == TestCharacterFieldValue
                        select s.RequestID;
                Assert.AreEqual(7, q.Count());

                proxy.DeleteEntryList(m => m.CharacterField == TestCharacterFieldValue);

                //after delete the count should be 0
                Assert.AreEqual(0, q.Count());
            }
            finally {
                if (context != null)
                    context.Dispose();
            }
        }
コード例 #11
0
        public void SetEntries_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);
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        where s.CharacterField == TestCharacterFieldValue
                        select s.IntegerField;
                Assert.AreEqual(7, q.Count());

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

                proxy.SetEntryList("'Character Field' = \"" + TestCharacterFieldValue + "\"", model, new string[] { "IntegerField" });

                foreach (var i in q)
                {
                    Assert.AreEqual(10, i);
                }
            }
            finally
            {
                if (context != null)
                    context.Dispose();
            }
        }
コード例 #12
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();
            }
        }
コード例 #13
0
        public void GetEntryList_by_expression_qulifier_fieldIds_nopage_nocount_noorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var models = proxy.GetEntryList(
                    m => m.CharacterField == TestCharacterFieldValue,
                    0,
                    null,
                    null,
                    null,
                    m => m.CharacterField
                    );

                Assert.AreEqual(7, models.Count);
                foreach (var model in models)
                {
                    Assert.AreEqual(TestCharacterFieldValue, model.CharacterField);
                }

            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #14
0
        public void DeleteEntries_string_contains_condition()
        {
            ARLoginContext context = null;
            try
            {
                context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        where s.CharacterField.Contains(TestCharacterFieldValueChinese + "%") && s.IntegerField == 3
                        select s.RequestID;
                Assert.AreEqual(2, q.Count());

                proxy.DeleteEntryList("'Character Field' LIKE \"" + TestCharacterFieldValueChinese + "%\" AND 'Integer Field' = 3");

                //after delete the count should be 0
                Assert.AreEqual(0, q.Count());
            }
            finally
            {
                if (context != null)
                    context.Dispose();
            }
        }
コード例 #15
0
        public void ARProxy_GetEntryListStatictisc_count_qulifier_nogroup_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                List<UInt32> groupIds = new List<UInt32>();
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                groupIds.Add(TestCharacterFieldId);
                var retlist = proxy.GetListEntryStatictisc(
                    "'Character Field' = \"Hello Remedy\"",
                    ARStatictisc.STAT_OP_COUNT,
                    null,
                    null
                    );
                Assert.AreEqual(1, retlist.Count);
                Assert.AreEqual(7, Convert.ToInt32(retlist[0].Statictisc));
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);

            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #16
0
        public void ARProxy_GetEntryList_qulifier_fieldIds_nopage_nocount_noorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                List<uint> fieldIds = new List<uint>();
                fieldIds.Add(TestCharacterFieldId);
                //int totalMatch = -1;
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var models = proxy.GetEntryList(
                    "'Character Field' = \"Hello Remedy\"",
                    fieldIds,
                    0,
                    null,
                    null,
                    null);

                Assert.AreEqual(7, models.Count);
                foreach (var model in models)
                {
                    Assert.AreEqual(TestCharacterFieldValue, model.CharacterField);
                }

            }
            catch(Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #17
0
        public void ARProxy_GetEntryList_qulifier_fieldIds_nopage_hascount_hasorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                TotalMatch total = new TotalMatch();
                List<UInt32> fieldIds = new List<UInt32>();
                fieldIds.Add(TestCharacterFieldId);
                fieldIds.Add(TestIntFieldId);
                fieldIds.Add(1u);
                List<ARSortInfo> sortInfo = new List<ARSortInfo>();
                sortInfo.Add(new ARSortInfo
                {
                    FieldId = TestCharacterFieldId,
                    Order = SortOrder.SORT_DESCENDING
                });

                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);

                var retlist = proxy.GetEntryList(
                    "'Character Field' LIKE \"%你好%\"",
                    fieldIds,
                    0,
                    null,
                    total,
                    sortInfo
                    );
                Assert.AreEqual(11, retlist.Count);
                Assert.AreEqual(11, total.Value);
                foreach (var entry in retlist)
                {
                    Assert.AreEqual(true, entry.CharacterField.Contains("你好"));
                }

                Assert.AreEqual(10, Convert.ToInt32(retlist.Max(m => m.RequestID)) - Convert.ToInt32(retlist.Min(m => m.RequestID)));

                Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[0].CharacterField);
                Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", retlist[1].CharacterField);
            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);

            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #18
0
        public void ARProxy_GetEntryList_qulifier_fieldIds_haspage_nocount_noorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                //int total = -1;
                List<UInt32> fieldIds = new List<UInt32>();
                fieldIds.Add(TestCharacterFieldId);
                fieldIds.Add(TestIntFieldId);
                fieldIds.Add(1u);
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var retlist = proxy.GetEntryList(
                    "'Character Field' LIKE \"%你好%\"",
                    fieldIds,
                    0,
                    5,
                    null,
                    null
                    );
                //paged count should be 5,although total matched count is 11
                Assert.AreEqual(5, retlist.Count);
                //Assert.AreEqual(-1, total);
                foreach (var entry in retlist)
                {
                    Assert.AreEqual(true, entry.CharacterField.Contains("你好"));
                }

                //assert the max id is greater 4 than min id
                //which means return the continous id list
                Assert.AreEqual(4, Convert.ToInt32(retlist.Max(m => m.RequestID)) - Convert.ToInt32(retlist.Min(m => m.RequestID)));

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

            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #19
0
        public void ARProxy_GetEntryList_by_Properties_Str_qulifier_fieldIds_nopage_nocount_noorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var models = proxy.GetEntryList(
                    "'Character Field' = \"Hello Remedy\"",
                    new string[]{ "CharacterField" },
                    null,
                    0,
                    null,
                    null);

                Assert.AreEqual(7, models.Count);
                foreach (var model in models)
                {
                    Assert.AreEqual(TestCharacterFieldValue, model.CharacterField);
                    Assert.AreEqual(null, model.IntegerField);
                }

                var models2 = proxy.GetEntryList(
                    "'Character Field' = \"Hello Remedy\"",
                    new string[] { "CharacterField", "IntegerField" },
                    null,
                    0,
                    null,
                    null);

                Assert.AreEqual(7, models2.Count);
                foreach (var model in models2)
                {
                    Assert.AreEqual(TestCharacterFieldValue, model.CharacterField);
                    Assert.AreEqual(1, model.IntegerField);
                }

            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }
コード例 #20
0
        public void ARProxy_GetEntryList_by_filter_qulifier_fieldIds_nopage_nocount_noorder_success()
        {
            ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
            try
            {
                ARProxy<NRemedy_Test_Regular_Form> proxy = new ARProxy<NRemedy_Test_Regular_Form>(context);
                var models = proxy.GetEntryList(
                    "'Character Field' = \"Hello Remedy\"",
                    0,
                    delegate(System.Reflection.PropertyInfo pi){
                        return pi.Name == "CharacterField";
                    },
                    null,
                    null,
                    null);

                Assert.AreEqual(7, models.Count);
                foreach (var model in models)
                {
                    Assert.AreEqual(TestCharacterFieldValue, model.CharacterField);
                    Assert.AreEqual(null, model.IntegerField);
                }

                var models2 = proxy.GetEntryList(
                    "'Character Field' = \"Hello Remedy\"",
                    0,
                    delegate(System.Reflection.PropertyInfo pi)
                    {
                        return pi.Name == "CharacterField" || pi.Name == "IntegerField";
                    },
                    null,
                    null,
                    null);

                Assert.AreEqual(7, models2.Count);
                foreach (var model in models2)
                {
                    Assert.AreEqual(TestCharacterFieldValue, model.CharacterField);
                    Assert.AreEqual(1, model.IntegerField);
                }

            }
            catch (Exception ex)
            {
                Assert.AreEqual(null, ex);
            }
            finally
            {
                context.Dispose();
            }
        }