Пример #1
0
        public void OneLoggerWithTwoLogs()
        {
            var log1     = "abc";
            var log2     = "def";
            var logStore = new LogStore();
            var logger   = new Logger(logStore);

            logger.Log(log1);
            logger.Log(log2);

            var sut = new LogReader(logStore);

            Assert.Equal(log2, sut.Get());
            Assert.Equal(log1, sut.Get());
        }
Пример #2
0
        public void OneLoggerWithTwoLogsOfDifferentPriority()
        {
            var log1     = "abc";
            var log2     = "def";
            var logStore = new LogStore();
            var logger   = new Logger(logStore);

            logger.Log(3, log1);
            logger.Log(1, log2);

            var sut = new LogReader(logStore);

            Assert.Equal(log1, sut.Get());
            Assert.Equal(log2, sut.Get());
        }
Пример #3
0
        public void GivenTestCase()
        {
            var logStore = new LogStore();
            var logger   = new Logger(logStore);

            logger.Log(1, "abc");
            logger.Log(2, "def");
            logger.Log(1, "ghi");

            var sut = new LogReader(logStore);

            Assert.Equal("def", sut.Get());
            Assert.Equal("ghi", sut.Get());
            Assert.Equal("abc", sut.Get());
            Assert.Null(sut.Get());
        }
Пример #4
0
        public void TwoLoggersWithOneLogEachOfDifferentPriority()
        {
            var log1     = "abc";
            var log2     = "def";
            var logStore = new LogStore();
            var logger1  = new Logger(logStore);

            logger1.Log(3, log1);

            var logger2 = new Logger(logStore);

            logger2.Log(1, log2);

            var sut = new LogReader(logStore);

            Assert.Equal(log1, sut.Get());
            Assert.Equal(log2, sut.Get());
        }
Пример #5
0
        public void LogContinueWithIntermediateStep()
        {
            var log1         = "abc";
            var log2         = "def";
            var log3         = "ghi";
            var logStore     = new LogStore();
            var logger1      = new Logger(logStore);
            var continuation = logger1.LogContinued(log1);

            logger1.Log(log3);

            continuation.LogContinued(log2).Complete();

            var sut = new LogReader(logStore);

            Assert.Equal(log1 + log2, sut.Get());
            Assert.Equal(log3, sut.Get());
        }
Пример #6
0
        public void LogContinueWithNoLogs()
        {
            var logStore = new LogStore();
            var logger1  = new Logger(logStore);

            logger1.LogContinued(null).Complete();

            var sut = new LogReader(logStore);

            Assert.Equal(null, sut.Get());
        }
Пример #7
0
        public void OneLoggerWithOneLog()
        {
            var log1     = "abc";
            var logStore = new LogStore();
            var logger1  = new Logger(logStore);

            logger1.Log(log1);

            var sut = new LogReader(logStore);

            Assert.Equal(log1, sut.Get());
        }
Пример #8
0
        public void LogContinue()
        {
            var log1     = "abc";
            var log2     = "def";
            var logStore = new LogStore();
            var logger1  = new Logger(logStore);

            logger1.LogContinued(log1).LogContinued(log2).Complete();

            var sut = new LogReader(logStore);

            Assert.Equal(log1 + log2, sut.Get());
        }
Пример #9
0
        public void LogContinueButNoCompletion()
        {
            var log1         = "abc";
            var log2         = "def";
            var logStore     = new LogStore();
            var logger1      = new Logger(logStore);
            var continuation = logger1.LogContinued(log1).LogContinued(log2);

            var sut = new LogReader(logStore);

            Assert.Null(sut.Get());

            continuation.Complete();
        }
Пример #10
0
        public void TwoLoggersWithOneLogEachWithTwoReaders()
        {
            var log1     = "abc";
            var log2     = "def";
            var logStore = new LogStore();
            var logger1  = new Logger(logStore);

            logger1.Log(3, log1);

            var logger2 = new Logger(logStore);

            logger2.Log(1, log2);

            var sut1 = new LogReader(logStore);

            Assert.Equal(log1, sut1.Get());

            var sut2 = new LogReader(logStore);

            Assert.Equal(log2, sut2.Get());
        }