public void Should_be_successful_when_the_user_is_authenticated()
        {
            // Arrange
            var        policy        = new DenyAnonymousAccessPolicy();
            const bool authenticated = true;
            var        context       = TestDataFactory.CreateSecurityContext(authenticated);

            // Act
            var result = policy.Enforce(context);

            // Assert
            Assert.That(result.ViolationOccured, Is.False);
        }
        public void Should_not_be_successful_when_the_user_is_anonymous()
        {
            // Arrange
            var        policy        = new DenyAnonymousAccessPolicy();
            const bool authenticated = false;
            var        context       = TestDataFactory.CreateSecurityContext(authenticated);

            // Act
            var result = policy.Enforce(context);

            // Assert
            Assert.That(result.ViolationOccured, Is.True);
            Assert.That(result.Message, Is.EqualTo("Anonymous access denied"));
        }