예제 #1
0
        public void Test_Hooks_Get()
        {
            try
            {
                HookDTO hook    = this.GetJohnsHook();
                HookDTO getHook = this.Api.Hooks.Get(hook.Id);

                Assert.AreEqual(getHook.Id, hook.Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
예제 #2
0
        public void Test_Hooks_Update()
        {
            try
            {
                HookDTO    hook    = this.GetJohnsHook();
                HookPutDTO hookPut = new HookPutDTO();
                hookPut.Status = hook.Status;
                hookPut.Url    = String.Format("http://test{0}.com", DateTime.Now.Ticks);

                HookDTO saveHook = this.Api.Hooks.Update(hookPut, hook.Id);

                Assert.AreEqual(saveHook.Id, hook.Id);
                Assert.AreEqual(hookPut.Url, saveHook.Url);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
예제 #3
0
        protected HookDTO GetJohnsHook()
        {
            if (BaseTest._johnsHook == null)
            {
                Pagination pagination        = new Pagination(1, 1);
                ListPaginated <HookDTO> list = this.Api.Hooks.GetAll(pagination);

                if (list != null && list.Count > 0 && list[0] != null)
                {
                    BaseTest._johnsHook = list[0];
                }
                else
                {
                    HookPostDTO hook = new HookPostDTO("http://test.com", EventType.PAYIN_NORMAL_CREATED);
                    BaseTest._johnsHook = this.Api.Hooks.Create(hook);
                }
            }

            return(BaseTest._johnsHook);
        }
예제 #4
0
        public void Test_Hooks_All()
        {
            try
            {
                HookDTO    hook       = this.GetJohnsHook();
                Pagination pagination = new Pagination(1, 1);

                ListPaginated <HookDTO> list = this.Api.Hooks.GetAll(pagination);

                Assert.IsNotNull(list[0]);
                Assert.IsTrue(list[0] is HookDTO);
                Assert.AreEqual(hook.Id, list[0].Id);
                Assert.AreEqual(pagination.Page, 1);
                Assert.AreEqual(pagination.ItemsPerPage, 1);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }