Ejemplo n.º 1
0
        private void TestChannelAutocreateFail(ChannelDirection direction)
        {
            CommunicationContainer mContainer
                = new CommunicationContainer(new CommunicationPolicy()
            {
                AutoCreateChannels = false
            });

            Channel channel = null;

            Assert.IsFalse(mContainer.TryGet("Freddy", direction, out channel));

            Assert.IsTrue(channel == null);

            Assert.IsFalse(mContainer.Exists("Freddy", direction));

            Assert.IsTrue(mContainer.Channels.Count() == 0);
        }
Ejemplo n.º 2
0
        private void TestChannelAutocreateSuccess(ChannelDirection direction)
        {
            CommunicationContainer mContainer
                = new CommunicationContainer(new CommunicationPolicy()
            {
                AutoCreateChannels = true
            });

            Channel channel;

            Assert.IsTrue(mContainer.TryGet("Freddy", direction, out channel));

            Assert.IsTrue(mContainer.Exists("Freddy", direction));

            Assert.IsTrue(channel.IsAutoCreated);

            Assert.IsTrue(mContainer.Channels.Count() == 1);
        }
Ejemplo n.º 3
0
        private void TestsAddRemove(Channel c1)
        {
            CommunicationContainer mContainer
                = new CommunicationContainer(new CommunicationPolicy()
            {
                AutoCreateChannels = true
            });

            Assert.IsTrue(mContainer.Add(c1));

            Assert.IsTrue(mContainer.Channels.Count() == 1);

            Assert.IsTrue(mContainer.Exists(c1.Id, c1.Direction));

            Assert.IsTrue(mContainer.Remove(c1));

            Assert.IsFalse(mContainer.Exists(c1.Id, c1.Direction));

            Assert.IsTrue(mContainer.Channels.Count() == 0);
        }
        /// <summary>
        /// This method creates the communication container. This container contains all the
        /// listeners and senders registered on the service, and assigns priority when polling for
        /// new incoming requests.
        /// </summary>
        /// <returns>The communication container.</returns>
        protected virtual CommunicationContainer InitialiseCommunicationContainer()
        {
            var container = new CommunicationContainer(Policy.Communication);

            return(container);
        }