MapToTrickleSpacedByPeriod() public method

public MapToTrickleSpacedByPeriod ( CoordinatedSharedMessageModel model, CountryCodeReplacement countryCodeReplacement, List excludedNumbers ) : TrickleSmsWithDefinedTimeBetweenEachMessage
model SmsWeb.Models.CoordinatedSharedMessageModel
countryCodeReplacement CountryCodeReplacement
excludedNumbers List
return SmsMessages.Coordinator.Commands.TrickleSmsWithDefinedTimeBetweenEachMessage
        public void MapToTrickleSpacedByTimePeriodWithCountryCodeReplacement()
        {
            var model = new CoordinatedSharedMessageModel
                {
                    Numbers = "04040404040, 11111111111",
                    Message = "Message",
                    StartTime = DateTime.Now.AddHours(2),
                    TimeSeparatorSeconds = 90,
                    Tags = "tag1, tag2",
                    Topic = "Dance Dance Revolution!",
                    ConfirmationEmail = "confirmation, anotherone; yetanother: more",
                    UserTimeZone = "Australia/Sydney"
                };

            var mappedDateTime = DateTime.Now;
            var olsenMapping = MockRepository.GenerateMock<IDateTimeUtcFromOlsenMapping>();
            olsenMapping.Expect(o => o.DateTimeWithOlsenZoneToUtc(model.StartTime, model.UserTimeZone)).Return(mappedDateTime);

            var mapper = new CoordinatorModelToMessageMapping(olsenMapping);
            var message = mapper.MapToTrickleSpacedByPeriod(model, new CountryCodeReplacement { CountryCode = "+61", LeadingNumberToReplace = "0"}, new List<string>());

            Assert.That(message.Messages.Count, Is.EqualTo(2));
            Assert.That(message.Messages[0].Mobile, Is.EqualTo("+614040404040"));
            Assert.That(message.Messages[0].Message, Is.EqualTo(model.Message));
            Assert.That(message.Messages[1].Mobile, Is.EqualTo(model.Numbers.Split(',')[1].Trim()));
            Assert.That(message.Messages[1].Message, Is.EqualTo(model.Message));
            Assert.That(message.MetaData.Tags, Is.EqualTo(model.Tags.Split(',').ToList().Select(t => t.Trim()).ToList()));
            Assert.That(message.MetaData.Topic, Is.EqualTo(model.Topic));
            Assert.That(message.StartTimeUtc, Is.EqualTo(mappedDateTime));
            Assert.That(message.TimeSpacing, Is.EqualTo(TimeSpan.FromSeconds(model.TimeSeparatorSeconds.Value)));
            Assert.That(message.ConfirmationEmail, Is.EqualTo(model.ConfirmationEmail));
            Assert.That(message.ConfirmationEmails.Count, Is.EqualTo(4));
            Assert.That(message.ConfirmationEmails[0], Is.EqualTo("confirmation"));
            Assert.That(message.ConfirmationEmails[1], Is.EqualTo("anotherone"));
            Assert.That(message.ConfirmationEmails[2], Is.EqualTo("yetanother"));
            Assert.That(message.ConfirmationEmails[3], Is.EqualTo("more"));
        }
        public void MapToTrickleSpacedByTimePeriodWithCountryCodeReplacement()
        {
            var model = new CoordinatedSharedMessageModel
                {
                    Numbers = "04040404040, 11111111111",
                    Message = "Message",
                    StartTime = DateTime.Now.AddHours(2),
                    TimeSeparatorSeconds = 90,
                    Tags = "tag1, tag2",
                    Topic = "Dance Dance Revolution!",
                    ConfirmationEmail = "confirmation"
                };
            var mapper = new CoordinatorModelToMessageMapping();
            var message = mapper.MapToTrickleSpacedByPeriod(model, new CountryCodeReplacement { CountryCode = "+61", LeadingNumberToReplace = "0"});

            Assert.That(message.Messages.Count, Is.EqualTo(2));
            Assert.That(message.Messages[0].Mobile, Is.EqualTo("+614040404040"));
            Assert.That(message.Messages[0].Message, Is.EqualTo(model.Message));
            Assert.That(message.Messages[1].Mobile, Is.EqualTo(model.Numbers.Split(',')[1].Trim()));
            Assert.That(message.Messages[1].Message, Is.EqualTo(model.Message));
            Assert.That(message.MetaData.Tags, Is.EqualTo(model.Tags.Split(',').ToList().Select(t => t.Trim()).ToList()));
            Assert.That(message.MetaData.Topic, Is.EqualTo(model.Topic));
            Assert.That(message.StartTimeUtc, Is.EqualTo(model.StartTime.ToUniversalTime()));
            Assert.That(message.TimeSpacing, Is.EqualTo(TimeSpan.FromSeconds(model.TimeSeparatorSeconds.Value)));
            Assert.That(message.ConfirmationEmail, Is.EqualTo(model.ConfirmationEmail));
        }
        public void MapToTrickleSetDurationBetweenMessagesRemovingExcludedNumbers()
        {
            var timeSpacing = 3;
            var model = new CoordinatedSharedMessageModel
                {
                    Numbers = "04040404040, 11111111111",
                    Message = "Message",
                    StartTime = DateTime.Now.AddHours(2),
                    TimeSeparatorSeconds = timeSpacing,
                    Topic = "Dance Dance Revolution!",
                    ConfirmationEmail = "*****@*****.**",
                    UserTimeZone = "Australia/Sydney"
                };

            var mappedDateTime = DateTime.Now;
            var olsenMapping = MockRepository.GenerateMock<IDateTimeUtcFromOlsenMapping>();
            olsenMapping.Expect(o => o.DateTimeWithOlsenZoneToUtc(model.StartTime, model.UserTimeZone)).Return(mappedDateTime);

            var mapper = new CoordinatorModelToMessageMapping(olsenMapping);
            var excludedNumbers = new List<string> { "04040404040" };
            var message = mapper.MapToTrickleSpacedByPeriod(model, new CountryCodeReplacement(), excludedNumbers);

            Assert.That(message.Messages.Count, Is.EqualTo(1));
            Assert.That(message.Messages[0].Mobile, Is.EqualTo(model.Numbers.Split(',')[1].Trim()));
            Assert.That(message.Messages[0].Message, Is.EqualTo(model.Message));
            Assert.That(message.MetaData.Tags, Is.EqualTo(null));
            Assert.That(message.MetaData.Topic, Is.EqualTo(model.Topic));
            Assert.That(message.StartTimeUtc, Is.EqualTo(mappedDateTime));
            Assert.That(message.TimeSpacing, Is.EqualTo(new TimeSpan(0, 0, 0, timeSpacing)));
            Assert.That(message.ConfirmationEmail, Is.EqualTo(model.ConfirmationEmail));
        }