Beispiel #1
0
        public void AddCustom_Should_Throw_InvalidPolicyConfigurationException()
        {
            // Arrange
            var policyBuilder = new PolicyBuilder <object>();

            // Act
            Action act = () => policyBuilder.AddCustom(o => o, null);

            // Assert
            act.Should().Throw <InvalidPolicyConfigurationException>();
        }
Beispiel #2
0
        public void AddCustom_Should_AddLinkToPolicyInMemoryRepository()
        {
            // Arrange
            string linkKey       = "CustomLink";
            string template      = "/api/custom";
            var    policyBuilder = new PolicyBuilder <object>();

            // Act
            policyBuilder.AddCustom(o => o, linkKey, template);

            // Assert
            PolicyInMemoryRepository.LinksPolicyInMemory
            .Any(p => (p as PolicyInMemoryRepository.TemplatePolicy) != null &&
                 (p as PolicyInMemoryRepository.TemplatePolicy).Template.Equals(template))
            .Should().BeTrue();
        }