public void ShouldSendMmsToSingleNumber()
            {
                var srv       = new StubMmsService();
                var presenter = new MmsCouponControlPresenter(srv);

                presenter.PhoneNumbers = "1234567890";
                presenter.SendCommand.Execute(null);

                Assert.AreEqual(1, srv.NumbersSentTo.Length);
                Assert.AreEqual("tel:1234567890", srv.NumbersSentTo[0].Number);
            }
            public void ShouldSendEmptySms()
            {
                var srv       = new StubMmsService();
                var presenter = new MmsCouponControlPresenter(srv);

                presenter.PhoneNumbers = "1234567890";
                presenter.Message      = String.Empty;
                presenter.SendCommand.Execute(null);

                Assert.IsNotNull(srv.MmsSent);
                Assert.IsTrue(String.IsNullOrWhiteSpace(srv.MmsSent.Body));
            }
            public void ShouldSendMmsToMultipleNumbers()
            {
                var srv       = new StubMmsService();
                var presenter = new MmsCouponControlPresenter(srv);

                presenter.PhoneNumbers = "1234567890,1098765432";
                presenter.SendCommand.Execute(null);

                Assert.IsTrue(srv.SendMmsToMultipleNumberMethodWasCalled);
                Assert.AreEqual(2, srv.NumbersSentTo.Length);
                Assert.AreEqual("tel:1234567890", srv.NumbersSentTo[0].Number);
                Assert.AreEqual("tel:1098765432", srv.NumbersSentTo[1].Number);
            }
            public void ShouldSendMmsWithText()
            {
                var smsText = "some text " + Guid.NewGuid().ToString();

                var srv       = new StubMmsService();
                var presenter = new MmsCouponControlPresenter(srv);

                presenter.PhoneNumbers = "1234567890";
                presenter.Message      = smsText;
                presenter.SendCommand.Execute(null);

                Assert.IsNotNull(srv.MmsSent);
                Assert.AreEqual(smsText, srv.MmsSent.Body);
            }
Ejemplo n.º 5
0
            public void ShouldClearFields()
            {
                var srv       = new StubMmsService();
                var presenter = new MmsControlPresenter(srv);

                presenter.PhoneNumbers = "1234567890";
                presenter.Message      = "test text";
                presenter.NewCommand.Execute(null);

                Assert.IsTrue(String.IsNullOrEmpty(presenter.PhoneNumbers));
                Assert.IsTrue(String.IsNullOrEmpty(presenter.Message));
                Assert.IsTrue(String.IsNullOrEmpty(presenter.MessageStatusName));
                Assert.AreEqual(MessageDeliveryStatus.Initial, presenter.MessageStatus);
            }
            public void ShouldUpdateMessageStatus()
            {
                var srv       = new StubMmsService();
                var presenter = new MmsCouponControlPresenter(srv);

                presenter.PhoneNumbers = "1234567890";

                var messageStatusUpdated = new ManualResetEvent(false);

                presenter.PropertyChanged += (sender, e) =>
                {
                    if (e.PropertyName.Equals("MessageStatus", StringComparison.CurrentCulture))
                    {
                        messageStatusUpdated.Set();
                    }
                };

                presenter.SendCommand.Execute(null);

                Assert.IsTrue(messageStatusUpdated.WaitOne(TimeSpan.FromSeconds(1)));
                Assert.AreEqual(MessageDeliveryStatus.DeliveredToTerminal, presenter.MessageStatus);
            }