Esempio n. 1
0
        public void LogErrorToFile()
        {
            string message = "TEST MESSAGE";

            var repo         = new FileSystemRepositoryFactory().CreateRepository();
            var errorFactory = new ErrorEntityFactory(message);

            var stringResult = repo.WriteLog(errorFactory);

            var result = this.DeserializeJsonObject <ErrorLogEntity>(stringResult);

            Assert.Equal(result.Type, "ERROR");
            Assert.Equal(result.Message, message);
        }
Esempio n. 2
0
        public void LogErrorToConsole()
        {
            string message = "TEST MESSAGE";

            var repo         = new ConsoleRepositoryFactory().CreateRepository();
            var errorFactory = new ErrorEntityFactory(message);

            var stringResult = repo.WriteLog(errorFactory);

            var result = this.DeserializeJsonObject <ErrorLogEntity>(stringResult);

            Assert.Equal(result.Type, "ERROR");
            Assert.Equal(result.Message, message);
            Assert.Equal(ConsoleColor.Red, Console.ForegroundColor);
        }