コード例 #1
0
        public void Write_Bufferred()
        {
            // Arrange
            var componentUnderTest = new DebugTextWriter();
            var output             = string.Empty;

            var buffer = "test".ToCharArray();

            var stubListener = new System.Diagnostics.Fakes.StubConsoleTraceListener
            {
                WriteString = s => { output = s; }
            };

            Debug.Listeners.Add(stubListener);

            // Act
            componentUnderTest.Write(buffer, 1, 2);

            // Assert
#if DEBUG
            output.ShouldHaveSameValueAs("es");
#endif
#if !DEBUG
            output.ShouldHaveSameValueAs("");
#endif
        }
コード例 #2
0
        public void Encoding()
        {
            // Arrange
            var componentUnderTest = new DebugTextWriter();

            // Act
            var actual = componentUnderTest.Encoding;

            // Assert
            actual.ShouldHaveSameValueAs(System.Text.Encoding.Default);
        }