Skip to content

Instantly share code, notes, and snippets.

@rarous
Created June 3, 2013 06:58
Show Gist options
  • Save rarous/5696496 to your computer and use it in GitHub Desktop.
Save rarous/5696496 to your computer and use it in GitHub Desktop.
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);
}
}
printf "HelloWorld";;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment