public void Write_TwoMessagesOnDifferentDays_TwoDaysGenerated() { var writer = new MoqWriter(); var message1 = Factory.Create<Message>(); var message2 = Factory.Create<Message>(); message1.Date = message2.Date.AddDays( 1 ); var conversation = new Conversation { ContactName = Factory.Create<string>(), PhoneNumber = Factory.Create<string>(), Messages = new List<Message> { message1, message2 } }; ConversationFile file = new ConversationFile( conversation, Factory.Create<string>() ); file.Write( writer ); string expectedResult = string.Concat( Common.GetExpectedHead( conversation.ContactName ), GetExpectedPageHeader( conversation ), "<div class='day'>", GetExpectedDayTitle( message1.Date ), GetExpectedMessageBody( message1 ), "</div><div class='day'>", GetExpectedDayTitle( message2.Date ), GetExpectedMessageBody( message2 ), "</div></body></html>" ); Assert.AreEqual( expectedResult, writer.Data ); }
public void Write_ArbitraryConversation_PathIsUsed() { var writer = new MoqWriter(); var path = Factory.Create<string>(); ConversationFile file = new ConversationFile( Factory.Create<Conversation>(), path ); file.Write( writer ); Assert.AreEqual( path, writer.Path ); }
public void Create_EmptyListOfMessages_BoringPageIsGenerated() { var writer = new MoqWriter(); var conversation = new Conversation { ContactName = Factory.Create<string>(), PhoneNumber = Factory.Create<string>(), Messages = new List<Message>() }; ConversationFile file = new ConversationFile( conversation, Factory.Create<string>() ); file.Write( writer ); string expectedResult = string.Concat( Common.GetExpectedHead( conversation.ContactName ), GetExpectedPageHeader( conversation ), "</body></html>" ); Assert.AreEqual( expectedResult, writer.Data ); }
public void Create_NullConversation_ArgumentNullExceptionIsThrown() { var file = new ConversationFile( null, Factory.Create<string>() ); }