public void SettingLogOutput_Should_RedirectLogOutput()
        {
            // arrange
            var logger = new TestStringLogger();
            var client = new TestBaseClient(new BaseRestClientOptions()
            {
                LogWriters = new List <ILogger> {
                    logger
                }
            });

            // act
            client.Log(LogLevel.Information, "Test");

            // assert
            Assert.IsFalse(string.IsNullOrEmpty(logger.GetLogs()));
        }
Пример #2
0
        public void SettingLogOutput_Should_RedirectLogOutput()
        {
            // arrange
            var stringBuilder = new StringBuilder();
            var client        = new TestBaseClient(new RestClientOptions("")
            {
                LogWriters = new List <TextWriter> {
                    new StringWriter(stringBuilder)
                }
            });

            // act
            client.Log(LogVerbosity.Info, "Test");

            // assert
            Assert.IsFalse(string.IsNullOrEmpty(stringBuilder.ToString()));
        }
Пример #3
0
        public void SettingLogVerbosity_Should_RestrictLogging(LogVerbosity verbosity, LogVerbosity testVerbosity, bool expected)
        {
            // arrange
            var stringBuilder = new StringBuilder();
            var client        = new TestBaseClient(new RestClientOptions("")
            {
                LogWriters = new List <TextWriter> {
                    new StringWriter(stringBuilder)
                },
                LogVerbosity = verbosity
            });

            // act
            client.Log(testVerbosity, "Test");

            // assert
            Assert.AreEqual(!string.IsNullOrEmpty(stringBuilder.ToString()), expected);
        }
        public void SettingLogLevel_Should_RestrictLogging(LogLevel?verbosity, LogLevel testVerbosity, bool expected)
        {
            // arrange
            var logger = new TestStringLogger();
            var client = new TestBaseClient(new RestClientOptions("")
            {
                LogWriters = new List <ILogger> {
                    logger
                },
                LogLevel = verbosity
            });

            // act
            client.Log(testVerbosity, "Test");

            // assert
            Assert.AreEqual(!string.IsNullOrEmpty(logger.GetLogs()), expected);
        }