Ejemplo n.º 1
0
        public void TestEmptyLogging()
        {
            var mgrMock = new Mock<IEntityManager<Log>>(MockBehavior.Strict);

            var dbLogger = new DatabaseLogger(mgrMock.Object);

            var errorMessage = " ";
            dbLogger.Log(errorMessage, LogType.Message);
        }
Ejemplo n.º 2
0
        public void TestMessageLogging()
        {
            var mgrMock = new Mock<IEntityManager<Log>>();

            var dbLogger = new DatabaseLogger(mgrMock.Object);

            Log log = null;
            mgrMock.Setup(repo => repo.Add(It.IsAny<Log>())).Callback<Log>(lg => log = lg);

            var errorMessage = "This is a plain message ";
            dbLogger.Log(errorMessage, LogType.Message);

            Assert.IsTrue((log != null) && (log.Message == errorMessage.Trim()) && (log.LogType == (int)LogType.Message));
        }