Created
June 3, 2013 06:58
-
-
Save rarous/5696496 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xunit; | |
public class HelloWorldTests { | |
[Fact] | |
public void ShouldSayHello { | |
var listener = new Listener(); | |
var helloWorld = new HelloWorld(); | |
helloWorld.SayHello(listener.Listen); | |
Asser.Equal("Hello world", listener.ReceivedMessage) | |
} | |
class Listener { | |
public void Listen(string message) { | |
ReceivedMessage = message; | |
} | |
public string ReceivedMessage { get; set; } | |
} | |
} | |
public class HelloWorld { | |
public void SayHello(Action<string> listener) { | |
listener("Hello World"); | |
} | |
} | |
static class Program { | |
public static void Main() { | |
var helloWorld = new HelloWorld(); | |
helloWorld.SayHello(Console.WriteLine); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printf "HelloWorld";; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment