Example #1
0
 public void TestCleanup()
 {
     writer.Messages.Clear();
     ConsoleBase.UnregisterConsoleWriter(writer);
     ConsoleBase.OptionalHeader             = string.Empty;
     Options.Instance.ColorizeConsoleOutput = true;
 }
Example #2
0
        public void WriteLine_WithEmptyHeader_WritesLineWithNoHeader()
        {
            var invalidStart = "[01]";
            var expectedEnd  = "Test Message";

            ConsoleBase.WriteLine(expectedEnd);
            var msg = writer.Messages.Last();

            Assert.IsTrue(!msg.StartsWith(invalidStart) && msg.Contains(expectedEnd));
        }
Example #3
0
        public void WriteLine_WithNonEmptyHeader_WritesLineWithHeader()
        {
            ConsoleBase.OptionalHeader = "01";
            var expectedStart = "[01]";
            var expectedEnd   = "Test Message";

            ConsoleBase.WriteLine(expectedEnd);
            var msg = writer.Messages.Last();

            Assert.IsTrue(msg.StartsWith(expectedStart) && msg.Contains(expectedEnd));
        }
Example #4
0
        /// <summary>
        /// Loads the options from a TOML file in the application directory.
        /// <para>If it exists, this file is automatically loaded when the application first starts.</para>
        /// </summary>
        /// <returns>An <see cref="Options"/> object.</returns>
        private static Options Load()
        {
            var path = Path.Combine(InitialParametersClass.ProgramDirectory.ToString(), "pellucid.console-options.toml");

            if (File.Exists(path))
            {
                try
                {
                    var options = MinimalTomlParser.DeserializeFromDisk <Options>(path);
                    return(options);
                }
                catch (Exception ex)
                {
                    ConsoleBase.WriteLine("Exception while loading Evands.Pellucid options from disk. Using the defaults instead.\n{0}", ex.ToString());
                    return(new Options().WithDefaults());
                }
            }
            else
            {
                return(new Options().WithDefaults());
            }
        }
 public void TestCleanup()
 {
     writer.Messages.Clear();
     ConsoleBase.UnregisterConsoleWriter(writer);
 }
 public void TestInitialize()
 {
     ConsoleBase.RegisterConsoleWriter(writer);
 }
Example #7
0
 public void TestCleanup()
 {
     writer.Messages.Clear();
     ConsoleBase.UnregisterConsoleWriter(writer);
     ConsoleBase.OptionalHeader = string.Empty;
 }