コード例 #1
0
        public void Should_be_successful_and_have_no_message()
        {
            // Arrange
            var policy = new DenyAnonymousAccessPolicy();

            // Act
            var result = PolicyResult.CreateSuccessResult(policy);

            // Assert
            Assert.That(result.ViolationOccured, Is.False);
            Assert.That(result.Message, Is.Null);
            Assert.That(result.PolicyType, Is.EqualTo(policy.GetType()));
        }
コード例 #2
0
        public void Should_be_unsuccessful_and_have_a_message()
        {
            // Arrange
            var message = "Failure";
            var policy  = new DenyAnonymousAccessPolicy();

            // Act
            var result = PolicyResult.CreateFailureResult(policy, message);

            // Assert
            Assert.That(result.ViolationOccured, Is.True);
            Assert.That(result.Message, Is.EqualTo(message));
            Assert.That(result.PolicyType, Is.EqualTo(policy.GetType()));
        }