Skip to content

Instantly share code, notes, and snippets.

@agross
Created January 17, 2009 22:51
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/48476 to your computer and use it in GitHub Desktop.
Save agross/48476 to your computer and use it in GitHub Desktop.
public class When_a_message_header_with_an_empty_prefix_is_parsed : With_message_and_parser
{
static When_a_message_header_with_an_empty_prefix_is_parsed()
{
FileName = "Messages\\One level, empty quote prefix.txt";
}
}
public abstract class With_message_and_parser
{
protected static string Message;
protected static MessageModel Model;
protected static MessageParser Parser;
protected static string FileName;
protected static string Load(string messageFile)
{
return File.ReadAllText(messageFile);
}
Establish context = () =>
{
Message = Load(FileName);
Parser = new MessageParser(" ");
};
protected Because of = () => { Model = Parser.Parse(Message); };
protected It should_return_one_section = () => Model.Sections.Count().ShouldEqual(1);
protected It should_set_the_send_date_in_the_header =
() => Model.Sections.First().Header.DateSent.ShouldEqual(new DateTime(2008, 12, 8, 18, 28, 00));
protected It should_set_the_sender_email_in_the_header =
() => Model.Sections.First().Header.SenderEmail.ShouldEqual("foo@bar.com");
protected 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