MapToTrickleOverPeriod() 공개 메소드

public MapToTrickleOverPeriod ( CoordinatedSharedMessageModel model, CountryCodeReplacement countryCodeReplacement, List excludedNumbers ) : TrickleSmsOverCalculatedIntervalsBetweenSetDates
model SmsWeb.Models.CoordinatedSharedMessageModel
countryCodeReplacement CountryCodeReplacement
excludedNumbers List
리턴 SmsMessages.Coordinator.Commands.TrickleSmsOverCalculatedIntervalsBetweenSetDates
        public void MapToTrickleOverTimePeriodWithCountryCodeReplacement()
        {
            var model = new CoordinatedSharedMessageModel
                {
                    Numbers = "04040404040, 11111111111",
                    Message = "Message",
                    StartTime = DateTime.Now.AddHours(2),
                    SendAllBy = DateTime.Now.AddHours(3),
                    Tags = "tag1, tag2",
                    Topic = "Dance Dance Revolution!",
                    ConfirmationEmail = "*****@*****.**"
                };
            var mapper = new CoordinatorModelToMessageMapping();
            var message = mapper.MapToTrickleOverPeriod(model, new CountryCodeReplacement { CountryCode = "+61", LeadingNumberToReplace = "0"});

            var coordinationDuration = model.SendAllBy.Value.Subtract(model.StartTime);
            Assert.That(coordinationDuration, Is.GreaterThan(new TimeSpan(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.Duration, Is.EqualTo(coordinationDuration));
            Assert.That(message.ConfirmationEmail, Is.EqualTo(model.ConfirmationEmail));
        }
        public void MapToTrickleOverTimePeriod()
        {
            var model = new CoordinatedSharedMessageModel
                {
                    Numbers = "04040404040, 11111111111",
                    Message = "Message",
                    StartTime = DateTime.Now.AddHours(2),
                    SendAllBy = DateTime.Now.AddHours(3),
                    Tags = "tag1, tag2",
                    Topic = "Dance Dance Revolution!",
                    ConfirmationEmail = "[email protected]: two",
                    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.MapToTrickleOverPeriod(model, new CountryCodeReplacement(), new List<string>());

            var coordinationDuration = model.SendAllBy.Value.Subtract(model.StartTime);
            Assert.That(coordinationDuration, Is.GreaterThan(new TimeSpan(0)));
            Assert.That(message.Messages.Count, Is.EqualTo(2));
            Assert.That(message.Messages[0].Mobile, Is.EqualTo(model.Numbers.Split(',')[0].Trim()));
            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.Duration, Is.EqualTo(coordinationDuration));
            Assert.That(message.ConfirmationEmail, Is.EqualTo(model.ConfirmationEmail));
            Assert.That(message.ConfirmationEmails.Count, Is.EqualTo(2));
            Assert.That(message.ConfirmationEmails[0], Is.EqualTo("*****@*****.**"));
            Assert.That(message.ConfirmationEmails[1], Is.EqualTo("two"));
            Assert.That(message.UserOlsenTimeZone, Is.EqualTo(model.UserTimeZone));
        }