public void Should_CallSaveMethodOfRepository_WhenCallingConvertForMailWithUnknownClientAndEmployee()
{
//arrange
var mailMessage = Builder<MailMessage>.CreateNew()
.With(x => x.Sender =
new MailAddress("[email protected]", "Client 1"))
.With(x => x.Receivers =
new List<MailAddress> { new MailAddress("[email protected]", "Employee 1") })
.Build();
var client = new Person
{
CreationDate = mailMessage.Date,
FirstName = "Client",
LastName = "1",
Email = "[email protected]"
};
var employee = new Person
{
CreationDate = mailMessage.Date,
FirstName = "Employee",
LastName = "1",
Email = "[email protected]"
};
repository.Query<Person>().Returns(new List<Person>().AsQueryable());
//act
mailMessagePersister.Convert(mailMessage);
//assert
repository.Received().Save(client);
repository.Received().Save(employee);
}