Exemplo n.º 1
0
        public static LogWriter getInstance()
        {
            if (instance == null)
                instance = new LogWriter();

            return instance;
        }
Exemplo n.º 2
0
        public void A_Line_Written_To_The_Log_Is_Appended_To_File_Log()
        {
            string file = "LogTest.txt";
            string hello = "Hello, Log!";

            var lw = new LogWriter(file);
            lw.Write(hello);

            StreamReader reader = new StreamReader(file);
            String read = reader.ReadLine();
            reader.Close();

            read.ShouldBe(hello);
        }
Exemplo n.º 3
0
        public void We_Can_Write_A_Line_To_A_File()
        {
            LogWriter writer = null;
            string logEntry = "Hello, Log!";

            Given("we have a logwriter", () => writer = new LogWriter());

            When("we write a line of text to the log", () =>
            {
                writer.Write(logEntry);
            });

            Then("the last line of the log should be the written text", () =>
            {
                String logFile = LogWriter.getInstance().LogFile;
                string lastLine = LastLineOf(logFile);

                lastLine.ShouldBe(logEntry);
            });
        }
Exemplo n.º 4
0
 public void We_Can_Write_A_Line_To_A_File()
 {
     var lw = new LogWriter();
     lw.Write("Hello, Log!");
     true.ShouldBeTrue();
 }