public void os_métodos_de_escrita_devem_retornar_uma_auto_referência() { // Arrange, Given var outputConsole = new OutputConsole( Substitute.For <IOutputWriter>(), Substitute.For <IOutputMarkersToConsoleColor>(), Substitute.For <IConsole>()) as IOutputConsole; // Act, When var retornoDeWrite = outputConsole.Write(null); var retornoDeWriteLine = outputConsole.WriteLine(null); // Assert, Then retornoDeWrite.Should().BeSameAs(outputConsole); retornoDeWriteLine.Should().BeSameAs(outputConsole); }
public void ao_escrever_um_texto_o_método_WriteToConsole_deve_ser_chamado() { // Arrange, Given var outputWriter = Substitute.For <IOutputWriter>(); var outputConsole = new OutputConsole( outputWriter, Substitute.For <IOutputMarkersToConsoleColor>(), Substitute.For <IConsole>()) as IOutputConsole; var textoDeExemplo = this.Fixture <string>(); // Act, When outputConsole.Write(textoDeExemplo); outputConsole.WriteLine(textoDeExemplo); // Assert, Then outputWriter.Received(1).Parse(textoDeExemplo, outputConsole.WriteToConsole); outputWriter.Received(1).Parse($"{textoDeExemplo}\n", outputConsole.WriteToConsole); }