public bool CanView() { bool permission = viewPermissions.CanView(); ViewPermissionNotGranted(permission, "ViewRecord"); bool modulePermission = modulePermissions.CanView(); ViewPermissionNotGranted(modulePermission, "ViewRecord"); return(permission && modulePermission); }
protected void CheckAllowedOperations(params ViewAllowedOperations[] operations) { IViewPermissions supportedOperations = ModuleMapping.GetSupportedOperations(); List <ViewAllowedOperations> allowedOperations = new List <ViewAllowedOperations>(); allowedOperations.AddRange(operations); Assert.That(supportedOperations.CanAdd(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.AddRecord)), "AddRecord"); Assert.That(supportedOperations.CanConfirm(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.ConfirmRecord)), "ConfirmRecord"); Assert.That(supportedOperations.CanDelete(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.DeleteRecord)), "DeleteRecord"); Assert.That(supportedOperations.CanModify(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.ModifyRecord)), "ModifyRecord"); Assert.That(supportedOperations.CanSplit(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.SplitRecord)), "SplitRecord"); Assert.That(supportedOperations.CanUnconfirm(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.UnconfirmRecord)), "UnconfirmRecord"); Assert.That(supportedOperations.CanView(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.ViewRecord)), "ViewRecord"); }