c# - "Hello World" - The TDD way? -


Well I was thinking about this for a while, since I was introduced to TDD. Which would be the best way to create a "Hello World" app? Which will print "Hello World" on the console - will use test driven development.

What does my test look like? And which sections around?

Request: No " Wikipedia-like " What is TDD, I'm familiar with TDD. There is only curiosity about how to deal with it.

You have to hide the console behind the interface.

Write a test Arrange IConsole consolemock = mock replica Kremlac & lt; IConsole & gt; (); // Initial injection of the console program. Console = consoleMock; // ACT program Hello World (); // Console Mock.AsertWasksCollad (x = & gt; x.WriteLine ("Hello World"); }

Write Program

  Public Static Class Program {Public Static Iconsole Console {get; Set; } // method "argument" public static zero hello () {Console.WriteLine ("Hello World"); } // Setup Real Environment Public Fixed Zero Main () {console = New RealConsole Implementation (); Hello world (); }}  

Refactors is something more useful; -)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -