Skip to content

Instantly share code, notes, and snippets.

class EmailSenderContext
{
protected static void email_was_sent()
{
SmailSender.SendEmail();
}
}
class When_an_email_is_sent : EmailSenderContext
{
Because we_did_something_we shouldnt = () =>
{
Exception = Catch.Exception(() => DevTeam.ReWriteFromScratch());
};
class DevTeamContext
{
protected static bool ExpectingException;
protected static Exception Exception;
protected static void dev_team_was_asked_to_do_a_rewrite()
{
var ex = Catch.Exception(() => DevTeam.ReWriteFromScratch());
if(ExpectingException)
Exception = ex;
class When_a_development_is_asked_to_do_a_rewrite :
{
Establish context = () => Expecting.Exception();
Because the_dev_team_was_asked_to_do_a_rewrite = () => DevTeam.ReWriteFromScratch();
It should_not_allow_the_dev_team_to_do_a_rewrite = () => Thrown.Exception.ShouldBeOfType<ProgrammersBeenGivenTooMuchFreedomException>();
}
class When_there_are_100_bottles_of_beer_on_the_wall : BottlesOfBeerContext
{
Establish there_are = () => 100.bottles_of_beer_on_the_wall();
Because we = take_one_down_and_pass_it_around;
It should_only_have_99_bottles_of_beer_on_the_wall = () => Bottles_of_beer_on_the_wall.ShouldEqual(99);
}
public static class BottlesOfBeerSetup
{
public static void bottles_of_beer_on_the_wall(this int numBottlesOfBeer)
public static class ActionResultExtensions
{
public static void ShouldBeAPartialView(this ActionResult actionResult)
{
actionResult.ShouldBeOfType<PartialViewResult>();
}
}
class Song
{
public void Sing()
{
Wall wall = new Wall();
wall.Beers.Add(new Beer("Peroni"));
foreach (Beer beer in wall.Beers)
{
private string _foo;
public string Foo
{
get { return _foo; }
set { _foo = value; }
}
var container = new WindsorContainer();
container.Install(new ConfigurationInstaller());
container.RegisterConfigurationEntity<Example>();
var example = container.Resolve<Example>();
if(example.IsAwesome)
Console.WriteLine("This is {0} awesome. Its level {1} awesome", example.HowAwesome, example.LevelOfAwesome);
var call = new XmlApiCall
{
Codec = new XmlCodec(),
Username = Settings.MeetingsManager,
Password = Settings.Password,
RequestAuthenticationMechanism = new OAuthWrapAuthenticationMechanism(OAuthToken)
};
var calendar = call.Get<WorkspaceCalendar>("v2/calendar/workspaces/123").Data;