public void TestDecorateActionInvocationFacet() {
            var config = new Mock<IAuditConfiguration>();
            var auditor = new Mock<IAuditor>();

            config.Setup(c => c.DefaultAuditor).Returns(auditor.Object.GetType());
            config.Setup(c => c.NamespaceAuditors).Returns(new Dictionary<string, Type> {{"", auditor.Object.GetType()}});

            var manager = new AuditManager(config.Object);

            var testSpec = new Mock<ISpecification>();
            var testHolder = new Mock<ISpecification>();
            var identifier = new Mock<IIdentifier>();
            var testFacet = new Mock<IActionInvocationFacet>();

            testHolder.Setup(h => h.Identifier).Returns(identifier.Object);

            testSpec.Setup(s => s.Identifier).Returns(identifier.Object);

            testFacet.Setup(n => n.FacetType).Returns(typeof (IActionInvocationFacet));

            testFacet.Setup(n => n.Specification).Returns(testSpec.Object);

            var facet = manager.Decorate(testFacet.Object, testHolder.Object);

            Assert.IsInstanceOfType(facet, typeof (AuditActionInvocationFacet));
        }
        public void TestCreateOk() {
            var config = new AuditConfiguration<IAuditor>();

            config.AddNamespaceAuditor<IAuditor>("namespace");

            // ReSharper disable once UnusedVariable
            var sink = new AuditManager(config);
        }
        public void TestCreateWrongDefaultAuditorType() {
            var config = new Mock<IAuditConfiguration>();

            config.Setup(c => c.DefaultAuditor).Returns(typeof (object));
            config.Setup(c => c.NamespaceAuditors).Returns(new Dictionary<string, Type>());

            try {
                // ReSharper disable once UnusedVariable
                var sink = new AuditManager(config.Object);
                Assert.Fail("Expect exception");
            }
            catch (Exception expected) {
                // pass test
                Assert.AreEqual("System.Object is not an IAuditor", expected.Message);
            }
        }