Exemplo n.º 1
0
        private void CreateMocks()
        {
            mockConnectionFactory = mocks.StrictMock <IConnectionFactory>();
            mockConnection        = mocks.StrictMock <IConnection>();
            mockSession           = mocks.StrictMock <ISession>();

            IQueue queue = mocks.StrictMock <IQueue>();

            Expect.Call(mockConnectionFactory.CreateConnection()).Return(mockConnection).Repeat.Once();
            if (UseTransactedTemplate)
            {
                Expect.Call(mockConnection.CreateSession(AcknowledgementMode.Transactional)).Return(mockSession).Repeat.
                Once();
            }
            else
            {
                Expect.Call(mockConnection.CreateSession(AcknowledgementMode.AutoAcknowledge)).Return(mockSession).
                Repeat.
                Once();
            }
            Expect.Call(mockSession.Transacted).Return(true);

            mockDestinationResolver =
                mocks.StrictMock <IDestinationResolver>();
            mockDestinationResolver.ResolveDestinationName(mockSession, "testDestination", false);
            LastCall.Return(queue).Repeat.Any();
        }
        private void CreateMocks()
        {
            mockConnectionFactory = (IConnectionFactory)mocks.CreateMock(typeof(IConnectionFactory));
            mockConnection        = (IConnection)mocks.CreateMock(typeof(IConnection));
            mockSession           = (ISession)mocks.CreateMock(typeof(ISession));

            TIBCO.EMS.Queue queue = new TIBCO.EMS.Queue("test"); //(Queue) mocks.CreateMock(typeof (Queue));

            Expect.Call(mockConnectionFactory.CreateConnection()).Return(mockConnection).Repeat.Once();
            if (UseTransactedTemplate)
            {
                Expect.Call(mockConnection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(mockSession).Repeat.
                Once();
            }
            else
            {
                Expect.Call(mockConnection.CreateSession(false, Session.AUTO_ACKNOWLEDGE)).Return(mockSession).
                Repeat.
                Once();
            }
            Expect.Call(mockSession.Transacted).Return(true);

            mockDestinationResolver =
                (IDestinationResolver)mocks.CreateMock(typeof(IDestinationResolver));
            mockDestinationResolver.ResolveDestinationName(mockSession, "testDestination", false);
            LastCall.Return(queue).Repeat.Any();
        }
 private IDestination GetReplyDestination(ISession session)
 {
     if (replyDestination != null)
     {
         return(replyDestination);
     }
     if (replyDestinationName != null)
     {
         AssertUtils.ArgumentNotNull(this.destinationResolver,
                                     "DestinationResolver is required when relying upon the 'replyDestinationName' property.");
         return(destinationResolver.ResolveDestinationName(
                    session, replyDestinationName, pubSubDomain));
     }
     return(session.CreateTemporaryQueue());
 }
Exemplo n.º 4
0
        private void CreateMocks()
        {
            mockConnectionFactory = A.Fake <IConnectionFactory>();
            mockConnection        = A.Fake <IConnection>();
            mockSession           = A.Fake <ISession>();

            IQueue queue = A.Fake <IQueue>();

            A.CallTo(() => mockConnectionFactory.CreateConnection()).Returns(mockConnection).Once();
            if (UseTransactedTemplate)
            {
                A.CallTo(() => mockConnection.CreateSession(AcknowledgementMode.Transactional)).Returns(mockSession).Once();
            }
            else
            {
                A.CallTo(() => mockConnection.CreateSession(AcknowledgementMode.AutoAcknowledge)).Returns(mockSession).Once();
            }

            A.CallTo(() => mockSession.Transacted).Returns(true);

            mockDestinationResolver = A.Fake <IDestinationResolver>();
            A.CallTo(() => mockDestinationResolver.ResolveDestinationName(mockSession, "testDestination", false)).Returns(queue);
        }
Exemplo n.º 5
0
        private void CreateMocks()
        {
            mockConnectionFactory = mocks.StrictMock<IConnectionFactory>();
            mockConnection = mocks.StrictMock<IConnection>();
            mockSession = mocks.StrictMock<ISession>();

            IQueue queue = mocks.StrictMock<IQueue>();

            Expect.Call(mockConnectionFactory.CreateConnection()).Return(mockConnection).Repeat.Once();
            if (UseTransactedTemplate)
            {
                Expect.Call(mockConnection.CreateSession(AcknowledgementMode.Transactional)).Return(mockSession).Repeat.
                    Once();
            }
            else
            {
                Expect.Call(mockConnection.CreateSession(AcknowledgementMode.AutoAcknowledge)).Return(mockSession).
                    Repeat.
                    Once();
            }
            Expect.Call(mockSession.Transacted).Return(true);

            mockDestinationResolver =
                mocks.StrictMock<IDestinationResolver>();
            mockDestinationResolver.ResolveDestinationName(mockSession, "testDestination", false);
            LastCall.Return(queue).Repeat.Any();
        }
Exemplo n.º 6
0
        private void CreateMocks()
        {
            mockConnectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory));
            mockConnection = (IConnection) mocks.CreateMock(typeof (IConnection));
            mockSession = (ISession) mocks.CreateMock(typeof (ISession));

            TIBCO.EMS.Queue queue = new TIBCO.EMS.Queue("test"); //(Queue) mocks.CreateMock(typeof (Queue));

            Expect.Call(mockConnectionFactory.CreateConnection()).Return(mockConnection).Repeat.Once();
            if (UseTransactedTemplate)
            {
                Expect.Call(mockConnection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(mockSession).Repeat.
                    Once();
            }
            else
            {
                Expect.Call(mockConnection.CreateSession(false, Session.AUTO_ACKNOWLEDGE)).Return(mockSession).
                    Repeat.
                    Once();
            }
            Expect.Call(mockSession.Transacted).Return(true);

            mockDestinationResolver =
                (IDestinationResolver) mocks.CreateMock(typeof (IDestinationResolver));
            mockDestinationResolver.ResolveDestinationName(mockSession, "testDestination", false);
            LastCall.Return(queue).Repeat.Any();
        }