Ejemplo n.º 1
0
        public void ExpectStxToDisposeThemselfWhenTheirEndTimerHasFired()
        {
            var s = new Mock<ISipMessageSender>();
            var l = new Mock<ISipListener>();
            var txTable = new SipServerTransactionTable();
            var tfsBuilder = new TimerFactoryStubBuilder();
            tfsBuilder.WithNonInviteStxEndCompletedTimerInterceptor((a) => new TxTimerStub(a, 1000, false, AfterCallBack));
            tfs = tfsBuilder.Build();
            for (int i = 0; i < Number; i++)
            {
                var r = new SipRequestBuilder().WithCSeq(new SipCSeqHeaderBuilder().WithSequence(i).Build()).Build();
                var stx = new SipNonInviteServerTransaction(txTable, r, l.Object, s.Object, tfs);

                /*go to completed state */
                stx.SendResponse(new SipResponseBuilder()
                    .WithStatusLine(new SipStatusLineBuilder()
                    .WithStatusCode(200)
                    .WithReason("OK")
                    .Build())
                    .Build());
            }

            /*wait for Number of timers to fire*/
            are.WaitOne();

            Assert.IsTrue(!txTable.AsEnumerable().Any());
        }
 public When_in_proceeding_state_the_send_trying_timer_fired()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     tf.WithInviteStxSendTryingTimerInterceptor((a) => new TxTimerStub(a, 200, false, AfterSendTryingFired));
     TimerFactory = tf.Build();
 }
Ejemplo n.º 3
0
 public When_in_confirmed_state()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     //tf.WithInviteStxEndConfirmedTimerInterceptor((a) => new TxTimerStub(a, 200, false, AfterCallBack));
     TimerFactory = tf.Build();
 }
 public When_WaitForAck_the_timer_expires()
 {
     _waitForTimeOut = new ManualResetEvent(false);
     _timerFactory = new TimerFactoryStubBuilder()
         .WithRingingTimerInterceptor(OnCreateRingingTimer)
         .WithInviteCtxTimeOutTimerInterceptor(OnCreateWaitForAckTimer).Build();
 }
 public When_in_completed_state_the_retransit_timer_fired_5_times()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     _originalInterval = 500;
     tf.WithInviteStxRetransmitTimerInterceptor((a) => new TxTimerStub(a, _originalInterval, false, AfterRetransmitFired));
     TimerFactory = tf.Build();
 }
 public When_in_completed_state_the_endcompleted_timer_fired()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     tf.WithInviteStxRetransmitTimerInterceptor((a) => new TxTimerStub(a, 500, false, ()=> { }));
     tf.WithInviteStxEndCompletedInterceptor((a) => new TxTimerStub(a, 64 * SipConstants.T1, false, AfterEndCompleted));
     TimerFactory = tf.Build();
 }
Ejemplo n.º 7
0
 public TxSpecificationBase()
 {
     Sender = new Mock<ISipMessageSender>();
     Listener = new Mock<ISipListener>();
     TxTable = new SipServerTransactionTable();
     Request = new SipRequestBuilder()
         .WithRequestLine
         (
         new SipRequestLineBuilder().WithMethod(SipMethods.Invite).Build()
         )
         .Build();
     TimerFactory = new TimerFactoryStubBuilder().Build();
 }
        public SipInviteClientDialogSpecificationBase()
        {
            _toTag = SipUtil.CreateTag();
            _fromTag = SipUtil.CreateTag();
            _callId = SipUtil.CreateCallId();
            _cSeq = 2;

            Sender = new Mock<ISipMessageSender>();
            Listener = new Mock<ISipListener>();
            DialogTable = new SipDialogTable();
            InvitingRequest = CreateInviteRequest();

            InviteCtx = new Mock<ISipClientTransaction>();
            InviteCtx.Setup((tx) => tx.Request).Returns(InvitingRequest);

            var tfb = new TimerFactoryStubBuilder();

            TimerFactory = tfb.Build();
        }
        public SipInviteServerDialogSpecificationBase()
        {
            _toTag = SipUtil.CreateTag();
            _fromTag = SipUtil.CreateTag();
            _callId = SipUtil.CreateCallId();
            _cSeq = 2;

            Sender = new Mock<ISipMessageSender>();
            Listener = new Mock<ISipListener>();
            DialogTable = new SipDialogTable();
            ReceivedRequest = CreateInviteRequest();

            InviteStx = new Mock<ISipServerTransaction>();
            InviteStx.Setup((tx) => tx.Request).Returns(ReceivedRequest);

            var tfb = new TimerFactoryStubBuilder()
               .WithInviteCtxRetransmitTimerInterceptor(OnCreateRetransmitOkTimer)
               .WithInviteCtxTimeOutTimerInterceptor(OnCreateTimeOutTimer);

            TimerFactory = tfb.Build();
        }
Ejemplo n.º 10
0
 public When_Established_Base()
 {
     _timerFactory = new TimerFactoryStubBuilder()
         .WithInviteCtxTimeOutTimerInterceptor(OnWaitForAckTimer)
         .Build();
 }
Ejemplo n.º 11
0
 public When_Ringing_Base()
 {
     _timerFactory = new TimerFactoryStubBuilder().WithRingingTimerInterceptor(OnCreateRingingTimer).Build();
 }
        protected override void Given()
        {
            //setup the Request property of the inc inviteserver
            ReceivedRequest = CreateInviteRequest();
            var tfb = new TimerFactoryStubBuilder();
            InviteStx = new Mock<ISipServerTransaction>();
            InviteStx.Setup((tx) => tx.Request).Returns(ReceivedRequest);

            //create the dialog;
            ServerDialog = new SipInviteServerDialog(InviteStx.Object,
                                                   DialogTable,
                                                   TimerFactory,
                                                   new SipHeaderFactory(),
                                                   new SipMessageFactory(), new SipAddressFactory(),
                                                   Sender.Object,
                                                   Listener.Object,
                                                   TestConstants.IpEndPoint1);

            GivenOverride();
        }
Ejemplo n.º 13
0
 public When_WaitForAck_Base()
 {
     _timerFactory = new TimerFactoryStubBuilder()
         .WithRingingTimerInterceptor(OnCreateRingingTimer)
         .WithInviteCtxTimeOutTimerInterceptor(OnCreateWaitForAckTimer).Build();
 }
Ejemplo n.º 14
0
 protected When_in_state_base()
     : base()
 {
     var tf = new TimerFactoryStubBuilder().Build();
        TimerFactory = tf;
 }
 public When_in_confirmed_state_a_resent_request_is_received()
     : base()
 {
     var tf = new TimerFactoryStubBuilder();
     TimerFactory = tf.Build();
 }
 public When_in_confirmed_state_the_endwaitforack_timer_has_fired()
 {
     var tfb = new TimerFactoryStubBuilder();
     tfb.WithInviteCtxTimeOutTimerInterceptor((a) => new TxTimerStub(a, SipConstants.T1, false, AfterEndWaitForAck));
     TimerFactory = tfb.Build();
 }
 public When_in_calling_state_the_timeout_timer_has_fired()
 {
     var tf = new TimerFactoryStubBuilder()
         .WithInviteCtxTimeOutTimerInterceptor(OnCreateTimeOutTimerStub).Build();
     TimerFactory = tf;
 }
Ejemplo n.º 18
0
 public When_in_completed_state()
     : base()
 {
     var tf = new TimerFactoryStubBuilder().Build();
     TimerFactory = tf;
 }
Ejemplo n.º 19
0
 public When_Ringing_a_long_time()
 {
     _lock = new object();
     _wait = new ManualResetEvent(false);
     _timerFactory = new TimerFactoryStubBuilder().WithRingingTimerInterceptor((a) => OnCreateRingingTimer(a, _periodicity)).Build();
 }