コード例 #1
0
ファイル: [0]Login.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void Login_with_admin_failed_and_try_a_success_again()
 {
     ARLoginContext context = null;
     try
     {
         context = new ARLoginContext(TestServer, TestChineseUser, TestChineseUserPwd + "something");
     }
     catch (ARException ex)
     {
         Assert.AreEqual(623, ex.MessageNumber); //183977-ErrorMsgs-7604.pdf page  72
         try
         {
             context = new ARLoginContext(TestServer, TestChineseUser, TestChineseUserPwd);
         }
         catch
         {
             Assert.AreEqual(null, ex);
         }
     }
     finally
     {
         if(context != null)
             context.Dispose();
     }
 }
コード例 #2
0
 public static void Initialize(TestContext context2)
 {
     ARLoginContext context = null;
     try
     {
         context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
         //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();
     }
 }
コード例 #3
0
        private static Object lockObject = new Object(); //保证对同一个Form,只有一种操作。

        /// <summary>
        /// Constructor 1
        /// </summary>
        /// <param name="context">LoginContext</param>
        public ARProxy(ARLoginContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            loginContext  = context;
            _metaProvider = new DefaultTypeMetaProvider <T>();
        }
コード例 #4
0
 /// <summary>
 /// Constructor 1
 /// </summary>
 /// <param name="context">LoginContext</param>
 /// <param name="metaProvider">provider for model metadata</param>
 public ARProxy(ARLoginContext context, ITypeMetaProvider <T> metaProvider)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if (metaProvider == null)
     {
         throw new ArgumentNullException("metaProvider");
     }
     loginContext  = context;
     _metaProvider = metaProvider;
 }
コード例 #5
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
        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();
            }
        }
コード例 #6
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
        public void LinqParse_OrderByDescending_clause()
        {
            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        orderby s.CharacterField descending
                        select s;
                TranslateResult tr = q.Translate<NRemedy_Test_Regular_Form>();
                Assert.IsTrue(tr.OrderByResult != null);
                Assert.AreEqual("CharacterField", tr.OrderByResult.OrderByList.First().Property);
                Assert.AreEqual("OrderByDescending", tr.OrderByResult.OrderByList.First().Method);

            }
        }
コード例 #7
0
ファイル: [4]BLOB.Test.cs プロジェクト: qianxuecheng/NRemedy
        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));
                    }
                }

            }
        }
コード例 #8
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();
            }
        }
コード例 #9
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void LinqQuery_select_anouymous_object_clause()
 {
     using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
     {
         ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
         var q = from s in set
                 select new
                 {
                     s.CharacterField,
                     s.IntegerField
                 };
         int count = 0;
         foreach (var g in q)
         {
             if (g.IntegerField == 1)
                 Assert.AreEqual(TestCharacterFieldValue, g.CharacterField);
             if (g.IntegerField == 2)
                 Assert.AreEqual(TestCharacterFieldValueChinese, g.CharacterField);
             if (g.IntegerField == 3)
                 Assert.AreEqual(TestCharacterFieldValueChinese + "Set Something", g.CharacterField);
             count++;
         }
         Assert.AreEqual(18, count);
     }
 }
コード例 #10
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();
            }
        }
コード例 #11
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();
            }
        }
コード例 #12
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void LinqParse_where_mixed_clause_02()
 {
     using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
     {
         ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
         var q = from s in set
                 where s.CharacterField.Contains("%Hello world%") && (s.IntegerField == 65535 || s.IntegerField > 65535)
                 select s;
         Assert.IsTrue(q.Provider is ARQueryProvider<NRemedy_Test_Regular_Form>);
         TranslateResult tr = q.Translate<NRemedy_Test_Regular_Form>();
         Assert.IsTrue(tr.ConditionResult != null);
         Assert.AreEqual("(('20000001' LIKE \"%Hello world%\") AND (('20000002' = 65535) OR ('20000002' > 65535)))"
             , tr.ConditionResult.Qulification.ToString());
     }
 }
コード例 #13
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
        public void LinqQuery_Skip_const_clause()
        {
            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set.Skip(7)
                        select s;
                int count = 0;
                foreach (var g in q)
                {
                    Assert.IsTrue(g.CharacterField.Contains("你好"));
                    count++;
                }
                Assert.AreEqual(11, count);

            }
        }
コード例 #14
0
ファイル: [0]Login.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void Login_with_admin_success()
 {
     ARLoginContext context = null;
     try
     {
         //login will be perform in the construct of ARLoginContext
         context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd);
     }
     catch (Exception ex)
     {
         Assert.AreEqual(null, ex);
     }
     finally
     {
         if(context != null)
             context.Dispose();
     }
 }
コード例 #15
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
        public void LinqQuery_OrderBy_clause()
        {
            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        orderby s.RequestID
                        select s;
                var q2 = from s in set
                         orderby s.RequestID descending
                         select s;
                var q2list = q2.ToList();
                int count = 17;
                foreach (var g in q)
                {
                    Assert.AreEqual(g.RequestID, q2list[count].RequestID);
                    count--;
                }
                Assert.AreEqual(-1, count);

            }
        }
コード例 #16
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();
            }
        }
コード例 #17
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();
            }
        }
コード例 #18
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();
            }
        }
コード例 #19
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
        public void LinqQuery_Take_Skip_Combine_clause()
        {
            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set.Take(9).Skip(7)
                        select s;
                int count = 0;
                foreach (var g in q)
                {
                    Assert.AreEqual(TestCharacterFieldValueChinese, g.CharacterField);
                    count++;
                }
                Assert.AreEqual(9, count);

            }
        }
コード例 #20
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
        public void LinqQuery_where_mixed_count_clause_01()
        {
            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
                var q = from s in set
                        where s.CharacterField.Contains("%Remedy%") && s.IntegerField == 3
                        select s;
                int count = q.Count();
                //foreach (var entry in q)
                //{
                //    Assert.IsTrue(entry.CharacterField.Contains("Remedy"));
                //    Assert.AreEqual(3, entry.IntegerField);
                //    count++;
                //}
                Assert.AreEqual(2, count);

            }
        }
コード例 #21
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void LinqQuery_where_gteq_clause()
 {
     using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
     {
         ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
         var q = from s in set
                 where s.IntegerField >= 2
                 select s;
         int count = 0;
         foreach (var entry in q)
         {
             Assert.IsTrue(entry.IntegerField >= 2);
             count++;
         }
         Assert.AreEqual(11, count);
     }
 }
コード例 #22
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
        public void LinqQuery_where_equal_clause()
        {
            using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
            {
                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;
                int count = 0;
                foreach (var entry in q)
                {
                    Assert.AreEqual(TestCharacterFieldValue, entry.CharacterField);
                    Assert.AreEqual(null, entry.Radio_Button_Field);
                    count++;
                }
                Assert.AreEqual(7, count);

            }
        }
コード例 #23
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();
            }
        }
コード例 #24
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();
            }
        }
コード例 #25
0
ファイル: [0]Login.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void Login_with_admin_failed_cause_bad_user()
 {
     ARLoginContext context = null;
     try
     {
         context = new ARLoginContext(TestServer, TestAdmin + "something", TestAdminPwd);
     }
     catch (ARException ex)
     {
         Assert.AreEqual(623, ex.MessageNumber); //183977-ErrorMsgs-7604.pdf page  72
     }
     finally
     {
         if(context != null)
             context.Dispose();
     }
 }
コード例 #26
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();
            }
        }
コード例 #27
0
ファイル: [0]Login.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void Login_with_chinese_admin_success()
 {
     ARLoginContext context = null;
     try
     {
         context = new ARLoginContext(TestServer, TestChineseUser, TestChineseUserPwd);
     }
     catch (ARException ex)
     {
         Assert.AreEqual(null, ex);
     }
     finally
     {
         if(context != null)
             context.Dispose();
     }
 }
コード例 #28
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void LinqParse_where_lt_clause()
 {
     using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
     {
         ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
         var q = from s in set
                 where s.DecimalNumberField < 2m
                 select s;
         Assert.IsTrue(q.Provider is ARQueryProvider<NRemedy_Test_Regular_Form>);
         TranslateResult tr = q.Translate<NRemedy_Test_Regular_Form>();
         Assert.IsTrue(tr.ConditionResult != null);
         Assert.AreEqual("('20000007' < 2)", tr.ConditionResult.Qulification.ToString());
     }
 }
コード例 #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();
            }
        }
コード例 #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();
     }
 }
コード例 #31
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();
            }
        }
コード例 #32
0
ファイル: [5]Linq.Test.cs プロジェクト: qianxuecheng/NRemedy
 public void LinqQuery_select_oneproperty_clause()
 {
     using (ARLoginContext context = new ARLoginContext(TestServer, TestAdmin, TestAdminPwd))
     {
         ARSet<NRemedy_Test_Regular_Form> set = new ARSet<NRemedy_Test_Regular_Form>(context);
         var q = from s in set
                 select s.CharacterField;
         int count = 0;
         foreach (var g in q)
         {
             Assert.IsTrue(g.Contains("Remedy"));
             count++;
         }
         Assert.AreEqual(18, count);
     }
 }