Skip to content

Instantly share code, notes, and snippets.

@agross
Created January 24, 2009 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agross/51447 to your computer and use it in GitHub Desktop.
Save agross/51447 to your computer and use it in GitHub Desktop.
using System;
namespace Machine.Specifications.Specs
{
public class when_a_date_is_parsed_with_the_regular_expression_parser : with_string_parser
{
Establish context = () => { Parser = new RegexParser(); };
It_should_behave_like a_date_time_parser = () => new DateTimeParsingBehavior();
}
public class when_a_date_is_parsed_by_the_infrastructure : with_string_parser
{
Establish context = () => { Parser = new InfrastructureParser(); };
It_should_behave_like a_date_time_parser = () => new DateTimeParsingBehavior();
}
public abstract class with_string_parser
{
protected static DateTime ParsedDate;
protected static IParser Parser;
protected Because of = () => { ParsedDate = Parser.Parse("2009/01/21"); };
}
public class DateTimeParsingBehavior
{
protected static DateTime ParsedDate;
It should_parse_the_expected_date = () => ParsedDate.ShouldEqual(new DateTime(2009, 1, 21));
It is_not_implemented;
[Ignore]
It is_ignored;
}
}
/*
yields:
when a date is parsed with the regular expression parser
» should parse the expected date
» is not implemented (NOT IMPLEMENTED)
» is ignored (IGNORED)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment