Exemplo n.º 1
0
        public ActionResult Delete(int id)
        {
            var filter = FilterService.FilterFetch(id);

            FilterService.FilterDelete(id);

            return(this.RedirectToAction("Index", filter.Target, null));
        }
Exemplo n.º 2
0
        public void Filter_Fetch()
        {
            var filter = FilterService.FilterNew();

            filter.Name   = DataHelper.RandomString(20);
            filter.Target = DataHelper.RandomString(20);
            filter.Query  = DataHelper.RandomString(20);

            filter = FilterService.FilterSave(filter);

            filter = FilterService.FilterFetch(filter.FilterId);

            Assert.IsFalse(filter == null, "Filter should not be null");
        }
Exemplo n.º 3
0
        public ActionResult Edit(int id, FilterFormModel model)
        {
            var filter = FilterService.FilterFetch(id);

            Csla.Data.DataMapper.Map(model, filter, true);

            filter = FilterService.FilterSave(filter);

            if (filter.IsValid)
            {
                model.Message = Resources.SaveSuccessfulMessage;
            }

            this.Map(filter, model, true);

            return(this.View(model));
        }
        public void Filter_Fetch()
        {
            var hour = BusinessHelper.CreateFilterAndLogon(
                FilterTestsWithRoleContribute.UserName,
                FilterTestsWithRoleContribute.UserPassword);

            Exception exception = null;

            try
            {
                FilterService.FilterFetch(hour.FilterId);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsTrue(exception == null, "Exception should be null");
        }
Exemplo n.º 5
0
        public ActionResult Edit(int id, string message)
        {
            var model = new FilterFormModel();

            try
            {
                var filter = FilterService.FilterFetch(id);

                model.Message = message;

                this.Map(filter, model, true);
            }
            catch (Exception ex)
            {
                this.ModelState.AddModelError(string.Empty, ex.Message);
            }

            return(this.View(model));
        }
        public void Filter_Edit()
        {
            var filter = FilterService.FilterNew();
            var name   = DataHelper.RandomString(20);

            filter.Name   = name;
            filter.Target = DataHelper.RandomString(20);
            filter.Query  = DataHelper.RandomString(20);

            filter = FilterService.FilterSave(filter);

            filter = FilterService.FilterFetch(filter.FilterId);

            filter.Name = DataHelper.RandomString(20);

            filter = FilterService.FilterSave(filter);

            filter = FilterService.FilterFetch(filter.FilterId);

            Assert.IsTrue(filter.Name != name, "Name should have different value");
        }
        public void Filter_Delete()
        {
            var filter = FilterService.FilterNew();

            filter.Name   = DataHelper.RandomString(20);
            filter.Target = DataHelper.RandomString(20);
            filter.Query  = DataHelper.RandomString(20);

            filter = FilterService.FilterSave(filter);

            filter = FilterService.FilterFetch(filter.FilterId);

            FilterService.FilterDelete(filter.FilterId);

            try
            {
                FilterService.FilterFetch(filter.FilterId);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.GetBaseException() is InvalidOperationException);
            }
        }
        public void Filter_Cannot_Edit_Record_For_Different_User()
        {
            var hour = BusinessHelper.CreateFilterAndLogon(
                FilterTestsWithRoleContribute.UserName,
                FilterTestsWithRoleContribute.UserPassword);

            Exception exception = null;

            try
            {
                hour = FilterService.FilterFetch(hour.FilterId);

                hour.Name = DataHelper.RandomString(20);

                FilterService.FilterSave(hour);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            Assert.IsTrue(exception != null, "Exception should not be null");
            Assert.IsTrue(exception.GetBaseException() is SecurityException, "Exception should be of type SecurityException");
        }