Skip to content

Instantly share code, notes, and snippets.

@agross
Created January 17, 2009 19:03
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/48417 to your computer and use it in GitHub Desktop.
Save agross/48417 to your computer and use it in GitHub Desktop.
public class When_a_message_header_is_parsed : With_message_and_parser
{
Establish_multiple contexts = () => new Action[]
{
() =>
{
Message = Load("Messages\\One level, empty quote prefix.txt");
Parser = new MessageParser(" ");
},
() =>
{
Message = Load("Messages\\One level, no quote prefix.txt");
Parser = new MessageParser(String.Empty);
},
() =>
{
Message = Load("Messages\\One level.txt");
Parser = new MessageParser("| ");
}
};
Because of = () => { Model = Parser.Parse(Message); };
It should_return_one_section = () => Model.Sections.Count().ShouldEqual(1);
It should_set_the_send_date_in_the_header =
() => Model.Sections.First().Header.DateSent.ShouldEqual(new DateTime(2008, 12, 8, 18, 28, 00));
It should_set_the_sender_email_in_the_header =
() => Model.Sections.First().Header.SenderEmail.ShouldEqual("foo@bar.com");
It should_set_the_sender_name_in_the_header = () => Model.Sections.First().Header.SenderName.ShouldEqual("Foo Bar");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment