Created
January 24, 2009 13:35
-
-
Save agross/51447 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; | |
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