public void HasAccess_WithCacheInvalidation_RequestsNewAccessTypes_ReturnsBooleanBasedOnRequestedAccess() { _securityProviderMock .Expect(_ => _.GetAccess(_context, _principalStub)) .Return(new[] { AccessType.Get(GeneralAccessTypes.Read) }) .Repeat.Once(); bool hasAccessOnFirstCall = _strategy.HasAccess( _securityProviderMock, _principalStub, new[] { AccessType.Get(GeneralAccessTypes.Read) }); Assert.That(hasAccessOnFirstCall, Is.True); _securityProviderMock.VerifyAllExpectations(); _invalidationToken.Invalidate(); _securityProviderMock.BackToRecord(); _securityProviderMock .Expect(_ => _.GetAccess(_context, _principalStub)) .Return(new[] { AccessType.Get(GeneralAccessTypes.Create) }) .Repeat.Once(); _securityProviderMock.Replay(); bool hasAccessOnSecondCall = _strategy.HasAccess( _securityProviderMock, _principalStub, new[] { AccessType.Get(GeneralAccessTypes.Create) }); Assert.That(hasAccessOnSecondCall, Is.True); _securityProviderMock.VerifyAllExpectations(); }