コード例 #1
0
        public void Write_WritesToScrawler()
        {
            var scrawlerMock = new Mock <Scrawler>();
            var context      = new WriteContext(scrawlerMock.Object);

            scrawlerMock.Setup(s => s.Write(TestWord))
            .Verifiable();

            context.Write(TestWord);

            scrawlerMock.Verify();
        }
コード例 #2
0
        public void WriteWithNullRef_WritesNullRefToScrawler()
        {
            // Writing a null reference to the context should
            // not write the context's null symbol, but rather a null reference.
            // This might seem a bit "offensive" at first,
            // but isn't really. Implementations must be specific for when to write the null
            // symbol and when to write null references, using either Write(null) or WriteNull()
            var scrawlerMock = new Mock <Scrawler>();
            var context      = new WriteContext(scrawlerMock.Object);

            scrawlerMock.Setup(s => s.Write(null))
            .Verifiable();

            context.Write(null);

            scrawlerMock.Verify();
        }