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 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 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_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 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_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 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"); }