Esempio n. 1
0
        public void TestAllKindMessages()
        {
            var message = DateTime.UtcNow.ToString();

            var testFactory = new LogMessageFactory(MessageKind.All);

            var testError   = testFactory.ErrorMessage(message);
            var testWarning = testFactory.WarningMessage(message);
            var testSuccess = testFactory.SuccessMessage(message);
            var testMessage = testFactory.Message(message);

            Assert.AreEqual(message, testMessage.Message);
            Assert.AreEqual(message, testSuccess.Message);
            Assert.AreEqual(message, testWarning.Message);
            Assert.AreEqual(message, testError.Message);

            Assert.AreEqual(MessageType.Message, testMessage.LogMessageType);
            Assert.AreEqual(MessageType.Success, testSuccess.LogMessageType);
            Assert.AreEqual(MessageType.Warning, testWarning.LogMessageType);
            Assert.AreEqual(MessageType.Error, testError.LogMessageType);

            Assert.IsTrue(testFactory.AllowedMessages.HasFlag(MessageKind.Message));
            Assert.IsTrue(testFactory.AllowedMessages.HasFlag(MessageKind.Success));
            Assert.IsTrue(testFactory.AllowedMessages.HasFlag(MessageKind.Warning));
            Assert.IsTrue(testFactory.AllowedMessages.HasFlag(MessageKind.Error));
        }
Esempio n. 2
0
        public void TestMessageCreation()
        {
            var message = DateTime.UtcNow.ToString();
            var type    = MessageType.Message;

            var testFactory = new LogMessageFactory(MessageKind.Message);
            var testObject  = testFactory.Message(message);

            Assert.AreEqual(message, testObject.Message);
            Assert.AreEqual(type, testObject.LogMessageType);
            Assert.IsTrue(testFactory.AllowedMessages.HasFlag(MessageKind.Message));
        }