public static Filter CreateFilterForUserAndLogon(string userName, string userPassword, int userId) { var name = DataHelper.RandomString(20); var password = DataHelper.RandomString(20); BusinessHelper.CreateUserWithFullControl(name, password); BusinessPrincipal.Login(name, password); var filter = FilterService.FilterNew(); var task = BusinessHelper.CreateTask(); filter.Name = DataHelper.RandomString(20); filter.Target = DataHelper.RandomString(20); filter.Query = DataHelper.RandomString(20); filter = FilterService.FilterSave(filter); BusinessPrincipal.Logout(); BusinessPrincipal.Login(userName, userPassword); return(filter); }
public static Filter CreateFilter() { var filter = FilterService.FilterNew(); filter.Name = DataHelper.RandomString(20); filter.Target = DataHelper.RandomString(20); filter.Query = DataHelper.RandomString(20); filter = FilterService.FilterSave(filter); return(filter); }
public void Filter_Add() { var filter = FilterService.FilterNew(); filter.Name = DataHelper.RandomString(20); filter.Target = DataHelper.RandomString(20); filter.Query = DataHelper.RandomString(20); Assert.IsTrue(filter.IsValid, "IsValid should be true"); FilterService.FilterSave(filter); }
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"); }
public void Filter_New() { Exception exception = null; try { FilterService.FilterNew(); } catch (Exception ex) { exception = ex; } Assert.IsTrue(exception == null, "Exception should be null"); }
public void Filter_Fetch_List() { var filter = FilterService.FilterNew(); filter.Name = DataHelper.RandomString(20); filter.Target = DataHelper.RandomString(20); filter.Query = DataHelper.RandomString(20); filter = FilterService.FilterSave(filter); filter.Name = DataHelper.RandomString(20); FilterService.FilterSave(filter); var categories = FilterService.FilterFetchInfoList(); Assert.IsTrue(categories.Count > 1, "Filters should be greater than one"); }
public ActionResult Create(FilterFormModel model) { var filter = FilterService.FilterNew(); Csla.Data.DataMapper.Map(model, filter, true); filter = FilterService.FilterSave(filter); if (filter.IsValid) { return(new JsonResult { Data = this.Url.Action("Edit", new { id = filter.FilterId, message = Resources.SaveSuccessfulMessage }) }); } this.Map(filter, model, false); return(this.View(model)); }
public ActionResult Create(string target, string query) { var model = new FilterFormModel(); try { var filter = FilterService.FilterNew(); filter.Target = target; filter.Query = query; this.Map(filter, model, true); } catch (Exception ex) { this.ModelState.AddModelError(string.Empty, ex.Message); } return(this.View(model)); }
public void Filter_New() { var filter = FilterService.FilterNew(); Assert.IsTrue(filter.IsNew, "IsNew should be true"); Assert.IsTrue(filter.IsDirty, "IsDirty should be true"); Assert.IsFalse(filter.IsValid, "IsValid should be false"); Assert.IsTrue(filter.IsSelfDirty, "IsSelfDirty should be true"); Assert.IsFalse(filter.IsSelfValid, "IsSelfValid should be false"); Assert.IsTrue(filter.IsActive, "IsActive should be true"); Assert.IsTrue(ValidationHelper.ContainsRule(filter, DbType.String, "Name"), "Name should be required"); Assert.IsTrue(ValidationHelper.ContainsRule(filter, DbType.String, "Target"), "Target should be required"); Assert.IsTrue(ValidationHelper.ContainsRule(filter, DbType.String, "Query"), "Query should be required"); }
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); } }