コード例 #1
0
        public void PauseMessageSetsSchedulePauseFlag_Data()
        {
            var scheduleSmsForSendingLater = new ScheduleSmsForSendingLater {SmsData = new SmsData("1", "2")};
            var data = new ScheduledSmsData
                {
                    OriginalMessage = scheduleSmsForSendingLater,
                    OriginalMessageData = new OriginalMessageData(scheduleSmsForSendingLater)
                };
            var scheduleId = Guid.NewGuid();
            var pauseScheduledMessageIndefinitely = new PauseScheduledMessageIndefinitely(scheduleId);
            Test.Initialize();
            Test.Saga<ScheduleSms>()
                .WithExternalDependencies(a => { a.Data = data; })
                .WhenReceivesMessageFrom("place")
                    .ExpectSendLocal<ScheduleStatusChanged>(s =>
                        {
                            return s.Status == MessageStatus.Paused &&
                            s.ScheduleId == pauseScheduledMessageIndefinitely.ScheduleMessageId &&
                            s.RequestTimeUtc == pauseScheduledMessageIndefinitely.MessageRequestTimeUtc;
                        })

                .When(s => s.Handle(pauseScheduledMessageIndefinitely));

            Assert.IsTrue(data.SchedulingPaused);
        }
コード例 #2
0
        public void PauseMessageSetsSchedulePauseFlag_Data()
        {
            var data = new ScheduledSmsData { OriginalMessage = new ScheduleSmsForSendingLater { SmsData = new SmsData("1", "2")}};
            var scheduleId = Guid.NewGuid();
            var pauseScheduledMessageIndefinitely = new PauseScheduledMessageIndefinitely(scheduleId);

            Test.Initialize();
            Test.Saga<ScheduleSms>()
                .WithExternalDependencies(a => a.Data = data)
                .WhenReceivesMessageFrom("place")
                    //.ExpectSend<SchedulePaused>(s => s.ScheduleId == scheduleId)
                .When(s => s.Handle(pauseScheduledMessageIndefinitely));

            Assert.IsTrue(data.SchedulingPaused);
        }
コード例 #3
0
        public void PauseMessageSetsSchedulePauseFlag_Data()
        {
            var data = new ScheduledSmsData { OriginalMessage = new ScheduleSmsForSendingLater { SmsData = new SmsData("1", "2")}};
            var scheduleId = Guid.NewGuid();
            var pauseScheduledMessageIndefinitely = new PauseScheduledMessageIndefinitely(scheduleId);
            StoreDocument(new ScheduleTrackingData { ScheduleId = data.OriginalMessage.ScheduleMessageId, MessageStatus = MessageStatus.Scheduled}, data.OriginalMessage.ScheduleMessageId.ToString());
            var ravenDocStore = MockRepository.GenerateMock<IRavenDocStore>();
            ravenDocStore.Expect(r => r.GetStore().OpenSession("SmsTracking")).Return(DocumentStore.OpenSession());

            Test.Initialize();
            Test.Saga<ScheduleSms>()
                .WithExternalDependencies(a => { a.Data = data; a.RavenDocStore = ravenDocStore; })
                .WhenReceivesMessageFrom("place")
                .When(s => s.Handle(pauseScheduledMessageIndefinitely));

            Assert.IsTrue(data.SchedulingPaused);
            var schedule = GetSchedule(data.OriginalMessage.ScheduleMessageId.ToString());
            Assert.That(schedule.MessageStatus, Is.EqualTo(MessageStatus.Paused));
        }