Exemple #1
0
        public void CanBindSpecificSeverities()
        {
            IBinder binder = new SeverityBinder(new MessageSeverity[]
                                                { MessageSeverity.CriticalError, MessageSeverity.Exception });

            Assert.IsTrue(binder.CanBind(new Message(MessageSeverity.CriticalError, string.Empty)));
            Assert.IsTrue(binder.CanBind(new Message(MessageSeverity.Exception, string.Empty)));

            Assert.IsFalse(binder.CanBind(new Message(MessageSeverity.Error, string.Empty)));
        }
Exemple #2
0
        public void CanBind()
        {
            IBinder binder = new SeverityBinder(null);

            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.Debug,
                                                         string.Empty, DateTime.Now, string.Empty)));
            Assert.IsTrue(binder.CanBind(new Message()));

            binder = new SeverityBinder(new MessageSeverity[] {});

            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.Debug,
                                                         string.Empty, DateTime.Now, string.Empty)));
            Assert.IsTrue(binder.CanBind(new Message()));
        }
Exemple #3
0
        public void CanBindAllSeverities()
        {
            IBinder binder = new SeverityBinder(new MessageSeverity[] { MessageSeverity.Sink });

            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.CriticalError,
                                                         string.Empty, DateTime.Now, string.Empty)));
            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.Debug,
                                                         string.Empty, DateTime.Now, string.Empty)));
            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.Error,
                                                         string.Empty, DateTime.Now, string.Empty)));
            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.Exception,
                                                         string.Empty, DateTime.Now, string.Empty)));
            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.Information,
                                                         string.Empty, DateTime.Now, string.Empty)));
            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.Unknown,
                                                         string.Empty, DateTime.Now, string.Empty)));
            Assert.IsTrue(binder.CanBind(new TextMessage(MessageSeverity.Warning,
                                                         string.Empty, DateTime.Now, string.Empty)));
        }