示例#1
0
        public void Should_return_handler_when_policy_type_is_not_match()
        {
            // Arrange
            var convention = new PolicyTypeToPolicyViolationHandlerInstanceConvention <DenyAnonymousAccessPolicy, DefaultPolicyViolationHandler>(() => new DefaultPolicyViolationHandler());
            var exception  = TestDataFactory.CreateExceptionFor(new IgnorePolicy());

            // Act
            var handler = convention.GetHandlerFor(exception);

            // Assert
            Assert.That(handler, Is.Null);
        }
        public void Should_return_handler_when_policy_type_is_not_match()
        {
            // Arrange
            var convention = new PolicyTypeToPolicyViolationHandlerInstanceConvention<DenyAnonymousAccessPolicy, DefaultPolicyViolationHandler>(() => new DefaultPolicyViolationHandler());
            var exception = TestDataFactory.CreateExceptionFor(new IgnorePolicy());

            // Act
            var handler = convention.GetHandlerFor(exception);

            // Assert
            Assert.That(handler, Is.Null);
        }