/// <summary>
        /// Adds a queue to the repository.
        /// </summary>
        /// <param name="queue">The queue.</param>
        /// <exception cref="System.ArgumentNullException">queue</exception>
        /// <exception cref="System.ArgumentException">Queue must have a name;queue.Name</exception>
        public void Add(StompQueue queue)
        {
            if (queue == null) throw new ArgumentNullException("queue");
            if (string.IsNullOrEmpty(queue.Name)) throw new ArgumentException("Queue must have a name", "queue.Name");

            //TODO: IF queues are added dynamically this could fail
            _queues.TryAdd(queue.Name, queue);
        }
        public void add_queue_requires_a_name()
        {
            var queue = new StompQueue();

            var    sut    = new MemoryQueueRepository();
            Action actual = () => sut.Add(queue);

            actual.ShouldThrow <ArgumentException>();
        }
        public void add_queue_requires_a_name()
        {
            var transactionManager = Substitute.For <ITransactionManager>();
            var queue = new StompQueue(transactionManager);

            var    sut    = new MemoryQueueRepository();
            Action actual = () => sut.Add(queue);

            actual.ShouldThrow <ArgumentException>();
        }
        public void add_queue_using_minimal_requirements()
        {
            var queue = new StompQueue();

            queue.Name = "mama";

            var sut = new MemoryQueueRepository();

            sut.Add(queue);
        }
        public void add_queue_using_minimal_requirements()
        {
            var transactionManager = Substitute.For <ITransactionManager>();
            var queue = new StompQueue(transactionManager);

            queue.Name = "mama";

            var sut = new MemoryQueueRepository();

            sut.Add(queue);
        }
        public void fetch_existing_queue()
        {
            var queue = new StompQueue();

            queue.Name = "mama";
            var sut = new MemoryQueueRepository();

            sut.Add(queue);

            var actual = sut.Get("mama");

            actual.Should().BeSameAs(queue);
        }
예제 #7
0
        /// <summary>
        /// Adds a queue to the repository.
        /// </summary>
        /// <param name="queue">The queue.</param>
        /// <exception cref="System.ArgumentNullException">queue</exception>
        /// <exception cref="System.ArgumentException">Queue must have a name;queue.Name</exception>
        public void Add(StompQueue queue)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }
            if (string.IsNullOrEmpty(queue.Name))
            {
                throw new ArgumentException("Queue must have a name", "queue.Name");
            }

            //TODO: IF queues are added dynamically this could fail
            _queues.TryAdd(queue.Name, queue);
        }
        public void fetch_existing_queue()
        {
            var transactionManager = Substitute.For <ITransactionManager>();
            var queue = new StompQueue(transactionManager);

            queue.Name = "mama";
            var sut = new MemoryQueueRepository();

            sut.Add(queue);

            var actual = sut.Get("mama");

            actual.Should().BeSameAs(queue);
        }