Ejemplo n.º 1
0
        public void AggregatedLoggerLogErrorTest()
        {
            var mockLogger1 = new Mock <ILogger>(MockBehavior.Strict);
            var mockLogger2 = new Mock <ILogger>(MockBehavior.Strict);

            mockLogger1.Setup(l => l.LogError(It.IsAny <string>()));
            mockLogger1.Setup(l => l.LogError(It.IsAny <string>()));
            mockLogger2.Setup(l => l.LogError(It.IsAny <string>()));
            mockLogger2.Setup(l => l.LogError(It.IsAny <string>()));
            var tested = new AggregateLogger(new List <ILogger> {
                mockLogger1.Object, mockLogger2.Object
            });

            tested.LogError(new Exception("test, not exception."));
            tested.LogError("test, not exception.");
            mockLogger1.VerifyAll();
        }