public void o_método_WriteToConsole_deve_escrever_no_console_em_cores_correspondentes_aos_marcadores() { // Arrange, Given var outputMarkers = Program.DependencyResolver.GetInstance <IOutputMarkers>(); var outputMarkersToConsoleColor = Program.DependencyResolver.GetInstance <IOutputMarkersToConsoleColor>(); var console = Substitute.For <IConsole>(); var outputConsole = new OutputConsole( Program.DependencyResolver.GetInstance <IOutputWriter>(), outputMarkersToConsoleColor, console) as IOutputConsole; foreach (var marcador in outputMarkers.Markers) { console.ClearReceivedCalls(); // Act, When var(esperadoParaForeground, esperadoParaBackground) = outputMarkersToConsoleColor.Convert(marcador); outputConsole.WriteToConsole(this.Fixture <string>(), marcador); // Assert, Then console.Received(1).BackgroundColor = esperadoParaBackground; console.Received(1).ForegroundColor = esperadoParaForeground; } }
o_método_WriteToConsole_deve_usar_IOutputMarkersToConsoleColor_para_formatar_de_acordo_com_o_marcador() { // Arrange, Given var outputMarkersToConsoleColor = Substitute.For <IOutputMarkersToConsoleColor>(); var outputConsole = new OutputConsole( Program.DependencyResolver.GetInstance <IOutputWriter>(), outputMarkersToConsoleColor, Substitute.For <IConsole>()) as IOutputConsole; var marcadorDeExemplo = this.Fixture <char>(); outputMarkersToConsoleColor.Convert(marcadorDeExemplo).Returns( this.Fixture <Tuple <ConsoleColor, ConsoleColor> >()); // Act, When outputConsole.WriteToConsole(null, marcadorDeExemplo); // Assert, Then outputMarkersToConsoleColor.Received(1).Convert(marcadorDeExemplo); }
public void o_método_WriteToConsole_deve_usar_IConsole_para_escrever_de_fato_no_console() { // Arrange, Given var console = Substitute.For <IConsole>(); var outputMarkersToConsoleColor = Substitute.For <IOutputMarkersToConsoleColor>(); var outputConsole = new OutputConsole( Program.DependencyResolver.GetInstance <IOutputWriter>(), outputMarkersToConsoleColor, console) as IOutputConsole; outputMarkersToConsoleColor.Convert((char)0).Returns( this.Fixture <Tuple <ConsoleColor, ConsoleColor> >()); var textoDeExemplo = this.Fixture <string>(); // Act, When outputConsole.WriteToConsole(textoDeExemplo); // Assert, Then console.Received(1).Write(textoDeExemplo); }