public static IncomingEmailMessageMock CreateWithRandomData(int numAttachments)
        {
            var mock = new IncomingEmailMessageMock
            {
                Subject           = RandomDataHelper.GetSubject(_seed++),
                RawBody           = RandomDataHelper.GetBody(_seed++),
                PlainTextBody     = RandomDataHelper.GetBody(_seed++),
                ConversationIndex = RandomDataHelper.GetConversationId(_seed++),
                ConversationTopic = RandomDataHelper.GetSubject(_seed++),
                SenderName        = RandomDataHelper.GetName(_seed++),
                SenderAlias       = RandomDataHelper.GetAlias(_seed++)
            };

            mock.SenderAddress = mock.SenderAlias + "@blah.com";
            mock.ToAddresses   = GetRandomAliasList(Rand.Next(1, 30));
            mock.CcAddresses   = GetRandomAliasList(Rand.Next(0, 30));
            mock.ToNames       = GetRandomNamesList(mock.ToAddresses.Count());
            mock.CcNames       = GetRandomNamesList(mock.CcAddresses.Count());
            mock.SentOn        = new DateTime(Rand.Next(2012, 2525), Rand.Next(1, 12), Rand.Next(1, 28));
            mock.ReceivedOn    = new DateTime(Rand.Next(2012, 2525), Rand.Next(1, 12), Rand.Next(1, 28));
            mock.IsHtmlBody    = Rand.Next(0, 1) == 0;

            var attachments = new List <IIncomingEmailAttachment>(numAttachments);

            for (var i = 0; i < numAttachments; i++)
            {
                attachments.Add(new IncomingAttachmentMock(Rand.Next(1, 100000)));
            }

            mock.Attachments = attachments;

            return(mock);
        }
        private static IEnumerable <string> GetRandomNamesList(int numNames)
        {
            if (numNames == 0)
            {
                return(new List <string>());
            }

            var names = new List <string>(numNames);

            for (var i = 0; i < numNames; ++i)
            {
                names.Add(RandomDataHelper.GetName(_seed++));
            }

            return(names);
        }