public void Test_ManySideRemove_AccessedViaDomainObject() { SecurableObject securableObject = _testHelper.CreateSecurableObject(); SecurableObject oldObject = _testHelper.CreateSecurableObject(); var childrenPropertyInfo = typeof(SecurableObject).GetProperty("Children"); _testHelper.Transaction.ExecuteInScope(() => securableObject.Children.Add(oldObject)); _testHelper.AddExtension(_extension); using (_testHelper.Ordered()) { _testHelper.ExpectPermissionReflectorGetRequiredMethodPermissions(MethodInfoAdapter.Create(childrenPropertyInfo.GetGetMethod()), TestAccessTypes.First); _testHelper.ExpectObjectSecurityStrategyHasAccess(securableObject, TestAccessTypes.First, true); _testHelper.ExpectPermissionReflectorGetRequiredMethodPermissions(_setMethodInformation, TestAccessTypes.Second); _testHelper.ExpectObjectSecurityStrategyHasAccess(oldObject, TestAccessTypes.Second, true); var childrenSetMethodInformation = new NullMethodInformation(); _testHelper.ExpectPermissionReflectorGetRequiredMethodPermissions(childrenSetMethodInformation, GeneralAccessTypes.Edit); _testHelper.ExpectObjectSecurityStrategyHasAccess(securableObject, GeneralAccessTypes.Edit, true); } _testHelper.ReplayAll(); _testHelper.Transaction.ExecuteInScope(() => securableObject.Children.Remove(oldObject)); _testHelper.VerifyAll(); }
public void TestEquals() { var nullMethodInformation2 = new NullMethodInformation(); Assert.That(_nullMethodInformation.Equals(nullMethodInformation2), Is.True); Assert.That(_nullMethodInformation.Equals(null), Is.False); }
public void GetRequiredMethodPermissions_WithNullMethod_ReturnsValueCopyFromCache() { _innerProviderStub.Stub(_ => _.GetRequiredMethodPermissions(null, null)).IgnoreArguments().Throw(new InvalidOperationException()); var methodInformation = new NullMethodInformation(); var result = _cacheDecorator.GetRequiredMethodPermissions(_type, methodInformation); Assert.That(result, Is.Empty); Assert.That(_cacheDecorator.GetRequiredMethodPermissions(_type, methodInformation), Is.SameAs(result)); }
public void Test_OneSideSetNull_AccessedViaDomainObject() { SecurableObject securableObject = _testHelper.CreateSecurableObject(); SecurableObject newObject = _testHelper.CreateSecurableObject(); _testHelper.AddExtension(_extension); using (_testHelper.Ordered()) { _testHelper.ExpectPermissionReflectorGetRequiredMethodPermissions(_setMethodInformation, TestAccessTypes.First); _testHelper.ExpectObjectSecurityStrategyHasAccess(securableObject, TestAccessTypes.First, true); var childrenSetMethodInformation = new NullMethodInformation(); _testHelper.ExpectPermissionReflectorGetRequiredMethodPermissions(childrenSetMethodInformation, GeneralAccessTypes.Edit); _testHelper.ExpectObjectSecurityStrategyHasAccess(newObject, GeneralAccessTypes.Edit, true); } _testHelper.ReplayAll(); _testHelper.Transaction.ExecuteInScope(() => securableObject.Parent = newObject); _testHelper.VerifyAll(); }
public void SetUp() { _nullMethodInformation = new NullMethodInformation(); }