@@ -109,7 +109,8 @@ public void StaticWriteLine_FormatsLogMessageCorrectly()
109109
110110 // Act - Using reflection to call internal static method
111111 typeof ( ConsoleWrapper )
112- . GetMethod ( "WriteLine" , System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Static , null , new [ ] { typeof ( string ) , typeof ( string ) } , null )
112+ . GetMethod ( "WriteLine" , System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Static ,
113+ null , new [ ] { typeof ( string ) , typeof ( string ) } , null )
113114 ? . Invoke ( null , new object [ ] { "INFO" , "Test log message" } ) ;
114115
115116 // Assert
@@ -123,16 +124,73 @@ public void ClearOutputResetFlag_ResetsFlag()
123124 // Arrange
124125 var consoleWrapper = new ConsoleWrapper ( ) ;
125126 ConsoleWrapper . SetOut ( _writer ) ;
126-
127+
127128 // Act
128129 consoleWrapper . WriteLine ( "First message" ) ; // Should set the reset flag
129130 ConsoleWrapper . ClearOutputResetFlag ( ) ;
130131 consoleWrapper . WriteLine ( "Second message" ) ; // Should set it again
131-
132+
132133 // Assert
133134 Assert . Equal ( $ "First message{ Environment . NewLine } Second message{ Environment . NewLine } ", _writer . ToString ( ) ) ;
134135 }
135136
137+ [ Fact ]
138+ public void Debug_InTestMode_WritesToTestOutputStream ( )
139+ {
140+ // Arrange
141+ var consoleWrapper = new ConsoleWrapper ( ) ;
142+ ConsoleWrapper . SetOut ( _writer ) ;
143+
144+ // Act
145+ consoleWrapper . Debug ( "debug message" ) ;
146+
147+ // Assert
148+ Assert . Equal ( $ "debug message{ Environment . NewLine } ", _writer . ToString ( ) ) ;
149+ }
150+
151+ [ Fact ]
152+ public void Debug_NotInTestMode_WritesToDebugConsole ( )
153+ {
154+ // Since capturing Debug output is difficult in a unit test
155+ // We'll use a mock or just verify the path doesn't throw
156+
157+ // Arrange
158+ var consoleWrapper = new ConsoleWrapper ( ) ;
159+ ConsoleWrapper . ResetForTest ( ) ; // Ensure we're not in test mode
160+
161+ // Act & Assert - Just verify it doesn't throw
162+ var exception = Record . Exception ( ( ) => consoleWrapper . Debug ( "debug message" ) ) ;
163+ Assert . Null ( exception ) ;
164+ }
165+
166+ [ Fact ]
167+ public void Error_DoesNotThrowWhenNotOverridden ( )
168+ {
169+ // Arrange
170+ var consoleWrapper = new ConsoleWrapper ( ) ;
171+ ConsoleWrapper . ResetForTest ( ) ; // Reset to ensure _override is false
172+
173+ // Act & Assert - Just verify it doesn't throw
174+ var exception = Record . Exception ( ( ) => consoleWrapper . Error ( "error without override" ) ) ;
175+ Assert . Null ( exception ) ;
176+ }
177+
178+ [ Fact ]
179+ public void Error_UsesTestOutputStreamWhenInTestMode ( )
180+ {
181+ // Arrange
182+ var consoleWrapper = new ConsoleWrapper ( ) ;
183+
184+ // Set test mode
185+ ConsoleWrapper . SetOut ( _writer ) ;
186+
187+ // Act
188+ consoleWrapper . Error ( "error in test mode" ) ;
189+
190+ // Assert
191+ Assert . Contains ( "error in test mode" , _writer . ToString ( ) ) ;
192+ }
193+
136194 public void Dispose ( )
137195 {
138196 ConsoleWrapper . ResetForTest ( ) ;
0 commit comments