public AdminController()
 {
     categoryService = new CategoryService();
     goodService     = new GoodService();
     blobService     = new BlobService();
     queueService    = new QueueService();
 }
Esempio n. 2
0
        public async Task NackOnException()
        {
            var queueConfig = new QueueConfiguration
            {
                QueueName              = QueueName,
                PrefetchCount          = 1,
                OnErrorAction          = QueueConfiguration.ErrorAction.NackOnException,
                ConsumerTag            = "consumer",
                RetryIntervalInSeconds = 1
            };
            var queue = new QueueService(ExposedRabbitService.validConfig, subscriberlogger.Object);

            queue.Start(queueConfig, handler);

            var initialConsumerCount = basicService.ExposedChannel.ConsumerCount(QueueName);

            basicService.ExposedChannel.BasicPublish(ExchangeName, "", true, null, Encoding.UTF8.GetBytes(TestMessages.Redeliver));
            await Task.Delay(RoundTripWaitTime);

            var inbetweenConsumerCount = basicService.ExposedChannel.ConsumerCount(QueueName);

            await Task.Delay(1000 + RoundTripWaitTime);

            var finalConsumerCount = basicService.ExposedChannel.ConsumerCount(QueueName);

            queue.Dispose();

            successCount.Should().Be(1, "because item is not excepted twice");
            processCount.Should().Be(2, "because first time exception, second time succesful process");
            initialConsumerCount.Should().Be(1);
            inbetweenConsumerCount.Should().Be(1, "because only the message is nacked");
            errorCount.Should().Be(1, "because error should be thrown first time");
            finalConsumerCount.Should().Be(1);
        }
Esempio n. 3
0
        public void Create(Notification notification)
        {
            var queueService = new QueueService();

            queueService.Enqueue(notification.Recipient.Id.ToString(),
                                 notification.ToString());
        }
Esempio n. 4
0
        public async Task DropMessage()
        {
            var queueConfig = new QueueConfiguration
            {
                QueueName              = QueueName,
                PrefetchCount          = 1,
                OnErrorAction          = QueueConfiguration.ErrorAction.DropMessage,
                ConsumerTag            = "consumer",
                RetryIntervalInSeconds = 1
            };
            var queue = new QueueService(ExposedRabbitService.validConfig, subscriberlogger.Object);

            queue.Start(queueConfig, handler);

            var initialConsumerCount = basicService.ExposedChannel.ConsumerCount(QueueName);

            basicService.ExposedChannel.BasicPublish(ExchangeName, "", true, null, Encoding.UTF8.GetBytes(TestMessages.Redeliver));
            await Task.Delay(RoundTripWaitTime);

            var finalConsumerCount = basicService.ExposedChannel.ConsumerCount(QueueName);

            queue.Dispose();

            processCount.Should().Be(1, "because the message is dropped");
            initialConsumerCount.Should().Be(1);
            errorCount.Should().Be(1);
            finalConsumerCount.Should().Be(1, "because consumer shouldn't have stopped");
        }
        /// <summary>
        /// Initiates a call to pull available gateways from Air Mesh.  All found gateways will be placed on an Azure Queue to be picked up by
        /// the Controllers Web Job
        /// </summary>
        /// <param name="timer"></param>
        /// <param name="log"></param>
        public static void PollGateways([TimerTrigger("00:15:00", RunOnStartup = true, UseMonitor = true)] TimerInfo timer, TextWriter log)
        {
            try
            {
                // Fire up Air Mesh API...
                var airMesh = new AirMeshService(log);

                // Get the available sites
                var siteIDs = airMesh.GetSiteIDs();

                // Get the Gateways for each site
                var gateways = airMesh.GetGateways(siteIDs);

                // Get the Azure Queue...
                var queue = QueueService.GetQueue(Constants.REAL_TIME_DEVICE_QUEUE);

                // Push the Gateways onto the queue
                foreach (var gateway in gateways)
                {
                    queue.AddMessageAsync(new CloudQueueMessage(JsonConvert.SerializeObject(gateway)));
                }
            }
            catch (Exception ex)
            {
                // TODO: Format logging
                log.WriteAsync(ex.ToString());
            }
        }
        public async Task Play([Remainder, Summary("The query or the URL of the youtube video.")] string urlOrQuery)
        {
            SocketGuild  guild = Context.Guild;
            QueueService queue = Queues.GetOrCreateService(guild.Id);

            string youtubeLink;
            string title = null;

            // Query, select first video found, works for links too.
            // If param looks like a valid Uri, don't search for title similarities.
            var result = Search(urlOrQuery, 1, Uri.IsWellFormedUriString(urlOrQuery, UriKind.Absolute) ? (Func <VideoInformation, int>)(x => (x.Url == urlOrQuery) ? 0 : 1) : null)[0];

            youtubeLink = result.Url;
            title       = result.Title;

            Enqueue(youtubeLink, title, guild.Id);

            await ReplyAsync(Enqueued(title));

            if (IsInVoiceChannel(guild, Context.Message.Author) && !IAmInVoiceChannel(FindVoiceChannel(guild, Context.Message.Author)))
            {
                await JoinAndPlay(queue, FindVoiceChannel(guild, Context.Message.Author));
            }
            else if (!queue.IsPlaying)
            {
                PlayQueue(queue, AudioClients.GetClient(guild.Id));
            }
        }
        public void AccessFilledQueue()
        {
            QueueService.setMessage("test1");
            var response = QueueService.getMessage();

            Assert.AreEqual("test1", response, "Oops...");
        }
        protected async Task InvokeAsync()
        {
            var sqsClient    = AwsClientsSingletonsProvider.GetSqsClient();
            var queueService = new QueueService(sqsClient);

            await queueService.AddMessageAsync(new ItemMessage(Guid.NewGuid()), GetQueueUrl());
        }
        ///Create two threads and assert they both get equal IDs
        public void QueueGameTest()
        {
            QueueService queueService = QueueService.Instance;

            Guid   id1 = Guid.Empty;
            Player p1  = Player.RED;
            Guid   id2 = Guid.Empty;
            Player p2  = Player.RED;

            var t1 = new Thread(() =>
            {
                (id1, p1) = queueService.MatchGame();
            });

            var t2 = new Thread(() =>
            {
                (id2, p2) = queueService.MatchGame();
            });

            t1.Start();
            t2.Start();
            t1.Join(50);
            t2.Join(50);

            Assert.NotEqual(id1, Guid.Empty);
            Assert.NotEqual(id2, Guid.Empty);
            Assert.Equal(id1, id2);
            Assert.NotEqual(p1, p2);
        }
Esempio n. 10
0
        public static async Task Run(
            // At 20 seconds past the minute every 3 minutes, between 7:00 PM and 7:59 AM every day except
            // from 4 AM to 5 AM when site maintenance seems like it might be happening--matching SyncGames.
            [TimerTrigger("20 */3 0-3,5-7,19-23 * * *")] TimerInfo timer,
            ILogger log)
        {
            var    queueService = new QueueService(Environment.GetEnvironmentVariable("AzureWebJobsStorage"));
            string playerID     = await queueService.GetNextPlayerFromBuildGamesBlobQueue();

            log.LogInformation($"Got next player from BuildGamesBlob queue: {playerID ?? "N/A"}.");
            if (playerID == null)
            {
                return;
            }

            var tableService = new TableService(Environment.GetEnvironmentVariable("AzureWebJobsStorage"));
            var games        = (await tableService.GetGameRows(playerID))
                               .Select(r => new GameBlobObject(r))
                               .OrderBy(r => r.Date)
                               .ToArray();

            log.LogInformation($"Queried games table for {playerID}: {games.Length} games found.");

            var blobService = new BlobService(Environment.GetEnvironmentVariable("AzureWebJobsStorage"));
            await blobService.UploadGamesBlobContent(playerID, JsonConvert.SerializeObject(games));

            log.LogInformation($"{playerID}'s games blob updated.");

            await queueService.RemovePlayerFromBuildGamesBlobQueue(playerID);

            log.LogInformation($"Removed {playerID} from BuildGamesBlob queue.");
        }
Esempio n. 11
0
        public BugService(IBugRepository bugRepository)
        {
            _bugRepository = bugRepository;

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <User, UserViewModel>()
                .ForMember(uvm => uvm.Role, opt => opt.MapFrom(u => (UserRole)u.UserRoleID));
                cfg.CreateMap <Project, ProjectViewModel>();
                cfg.CreateMap <Bug, BaseBugViewModel>();
                cfg.CreateMap <Bug, BugViewModel>()
                .ForMember(bvm => bvm.AssignedUser, opt => opt.MapFrom(b => b.User))
                .ForMember(bgm => bgm.Status, opt => opt.MapFrom(b => (BugStatus)b.StatusID))
                .ForMember(bgm => bgm.Priority, opt => opt.MapFrom(b => (BugPriority)b.PriorityID));
                cfg.CreateMap <Bug, FullBugViewModel>()
                .ForMember(fbvm => fbvm.AssignedUser, opt => opt.MapFrom(b => b.User))
                .ForMember(fbvm => fbvm.Status, opt => opt.MapFrom(b => (BugStatus)b.StatusID))
                .ForMember(fbvm => fbvm.Priority, opt => opt.MapFrom(b => (BugPriority)b.PriorityID))
                .ForMember(fbvm => fbvm.Comments, opt => opt.Ignore());
                cfg.CreateMap <CommentModel, CommentViewModel>();
                cfg.CreateMap <BugFormViewModel, Bug>();
            });

            _mapper       = config.CreateMapper();
            _queueService = new QueueService();
        }
Esempio n. 12
0
 public void TestQueueService_CTOR_ChannelNull()
 {
     Assert.That(() =>
                 { var qs = new QueueService(null); },
                 Throws.TypeOf <ArgumentNullException>()
                 );
 }
        public void ShouldReuseExistingQueue()
        {
            var result = new QueueService().GetPrivateQueues(ComputerName);

            Assert.That(result.Count(q => q.QueueName.ToLower().Contains(NameOfNewQueue.ToLower())),
                        Is.EqualTo(1));
        }
Esempio n. 14
0
        public void ProcessMessage()
        {
            var logger        = new Mock <ILogger>();
            var loggerFactory = new Mock <ILoggerFactory>();

            loggerFactory.Setup(c => c.CreateLogger(It.IsAny <string>())).Returns(logger.Object);

            var metricsRepo = new Mock <IMetricsRepository>();

            var model = new Mock <IModel>();

            var connection = new Mock <IConnection>();

            connection.Setup(c => c.CreateModel()).Returns(model.Object);

            var connectonFactory = new Mock <ConnectionFactory>();

            connectonFactory.Setup(c => c.CreateConnection()).Returns(connection.Object);

            var queueConsumerService = new Mock <IQueueConsumerService>();

            var queueService = new QueueService(queueConsumerService.Object, connectonFactory.Object, loggerFactory.Object);

            Assert.NotNull(queueService);

            var handler = new Mock <IMessageHandler>();

            queueService.RegisterHandler(handler.Object);

            queueService.ProcessMessage("the message body", queueConsumerService.Object, It.IsAny <ulong>(), new QueueMetric());
        }
Esempio n. 15
0
        public void CreateInstance()
        {
            var logger        = new Mock <ILogger>();
            var loggerFactory = new Mock <ILoggerFactory>();

            loggerFactory.Setup(c => c.CreateLogger(It.IsAny <string>())).Returns(logger.Object);

            var metricsRepo = new Mock <IMetricsRepository>();

            var model = new Mock <IModel>();

            var connection = new Mock <IConnection>();

            connection.Setup(c => c.CreateModel()).Returns(model.Object);

            var connectonFactory = new Mock <ConnectionFactory>();

            connectonFactory.Setup(c => c.CreateConnection()).Returns(connection.Object);

            var queueConsumerService = new Mock <IQueueConsumerService>();

            var queueService = new QueueService(queueConsumerService.Object, connectonFactory.Object, loggerFactory.Object);

            Assert.NotNull(queueService);
        }
Esempio n. 16
0
        public JsonResult Register(char qType)
        {
            QueueService qService = new QueueService();
            Queue        qNo      = qService.Register((QueueType)qType);

            return(new JsonResult(qNo));
        }
Esempio n. 17
0
        public WatcherService(ILogger <WatcherService> loggingService)
        {
            logger = loggingService;
            logger.LogInformation("Loading watchers");
            ConfPath = (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) ? "/etc/" + CONFNAME : Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + CONFNAME;
            if (!File.Exists(ConfPath))
            {
                var defConf = Assembly.GetExecutingAssembly().GetManifestResourceStream("HandBrake_daemon.default.conf");
                using var sr = new StreamReader(defConf);
                File.WriteAllText(ConfPath, sr.ReadToEnd());
            }
            _QueueService = QueueService.Instance;


            var unprocessedPresets = Process.Start(new ProcessStartInfo
            {
                FileName  = ("HandBrakeCLI"),
                Arguments = "--preset-list",
                RedirectStandardOutput = true,
                RedirectStandardError  = true
            }).StandardError.ReadToEnd();
            var reg = @"\n[\s]{4}([^\s].*)$";

            Presets.AddRange(from Match m in Regex.Matches(unprocessedPresets, reg, RegexOptions.Multiline)
                             select m.Groups[1].ToString().Trim());
            LoadWatchlist();
            CheckPermissions();
            ScanWatchDirs();
        }
Esempio n. 18
0
        public void SendNotifications()
        {
            IDBManager   dBManager = new MSSQLDBManager();
            QueueService qs        = new QueueService(dBManager);

            qs.DequeueAndProcess();
        }
Esempio n. 19
0
        static void Main(string[] args)
        {
            CharacterGenerator generator = new CharacterGenerator();
            IQueueService      service   = new QueueService();

            service.QueueTick += DungeonQueueEventHandler;

            Console.WriteLine("Add players to the queue. W for Warrior, P for Priest");

            string input = "";

            while ((input = Console.ReadLine()) != "x")
            {
                if (input.ToLower() == "w")
                {
                    Character c = generator.Warrior();
                    service.AddCharacter(c);

                    Console.WriteLine("Added new Warrior: " + c.Name);
                }
                if (input.ToLower() == "p")
                {
                    Character c = generator.Priest();
                    service.AddCharacter(c);

                    Console.WriteLine("Added new Priest: " + c.Name);

                    service.AddCharacter(generator.Priest());
                }
            }
        }
Esempio n. 20
0
        public static MessageQueue CreatePrivateQueue(string computerName, string queueName, bool isTransactional)
        {
            var queuePath    = CreateQueuePathForPrivateQueue(computerName, queueName, isTransactional);
            var queueService = new QueueService();

            return(queueService.CreateQueue(queuePath, isTransactional));
        }
Esempio n. 21
0
        public static async Task Main(string[] args)
        {
            Console.CancelKeyPress += Console_CancelKeyPress;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("Consumer - reading messages, processing and deleting from Azure queue 500 ms.");
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("Press 1 to read One message at a time, or any other key to read Five messages at a time: ");
            var key = Console.ReadKey(true);

            singleMessage = key.Key == ConsoleKey.D1;

            // Using a SAS Key that is valid for a fixed period only.
            // "Connection String" value when Generare SAS and connection string button in Azure
            // OR - use from app.config "appSettings" -> AzureQueueStorageConnectionString
            var connectionString = CloudConfigurationManager.GetSetting("AzureQueueStorageConnectionString");

            IQueueService queueService = new QueueService(connectionString, "samplequeue");

            if (key.Key == ConsoleKey.D1)
            {
                await ProcessOneMessage(queueService);
            }
            else
            {
                await ProcessFiveMessages(queueService);
            }

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            Console.WriteLine("Completed. Press a key to exit.");
            Console.ReadKey();
        }
Esempio n. 22
0
        public async Task DripFeedMessages(uint prefetch, int numberofMessages)
        {
            var queueConfig = new QueueConfiguration
            {
                QueueName              = QueueName,
                PrefetchCount          = (ushort)prefetch,
                OnErrorAction          = QueueConfiguration.ErrorAction.RestartConnection,
                ConsumerTag            = "consumer",
                RetryIntervalInSeconds = 10
            };
            var queue = new QueueService(ExposedRabbitService.validConfig, subscriberlogger.Object);

            queue.Start(queueConfig, handler);

            for (uint messagecount = 1; messagecount < numberofMessages + 1; messagecount++)
            {
                basicService.ExposedChannel.BasicPublish(ExchangeName, "", true, null, Encoding.UTF8.GetBytes("message"));
                await Task.Delay(RoundTripWaitTime);

                var queueMessageCount = basicService.ExposedChannel.MessageCount(QueueName);

                if (prefetch > messagecount)
                {
                    queueMessageCount.Should().Be(0, "because there are {0} messages with {1} prefetch", messagecount, prefetch);
                    processCount.Should().Be(messagecount, "because the prefetch is {0}", prefetch);
                }
                // if prefetch is greater than message number, then the final count should be 0.
                else
                {
                    queueMessageCount.Should().Be(messagecount - prefetch, "because there are messages in queue exceeds prefetch");
                    processCount.Should().Be(prefetch, "because the prefetch exceeds number of messages");
                }
            }
            queue.Dispose();
        }
Esempio n. 23
0
        public QueueVM()
        {
            User = new User()
            {
                Id            = 112,
                Login         = "******",
                isActive      = true,
                isSendingData = false
            };


            QueueView    = new QueueViewData();
            QueueData    = new QueueData();
            QueueService = new QueueService(QueueData, User);

            _connectCommand    = new ConnectCommand(this);
            _disconnectCommand = new DisconnectCommand(this);

            //QueueView.AdditionalMessage = "Lorem ipsum loros dalej nie pamietam jak to leciało, ale potrzebuje troche wiecej tekstu";

            QueueData.PropertyChanged += QueueData_PropertyChanged;

            //QueueView.AdditionalMessage = "Lorem ipsum loros dalej nie pamietam jak to leciało, ale potrzebuje troche wiecej tekstu";
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                QueueView.QueueNoMessage    = "PB123456";
                QueueView.AdditionalMessage = "Lorem ipsum loros dalej nie pamietam jak to leciało, ale potrzebuje troche wiecej tekstu";
            }
        }
Esempio n. 24
0
    public static void ProduceTasks()
    {
        Random random = new Random();

        for (int i = 1; i <= 1; i++)
        {
            var queue = new QueuedObject
            {
                QueueID          = i,
                ProducerThreadID = Thread.CurrentThread.ManagedThreadId,
                EnqueueDateTime  = DateTime.Now,
                // Used to Generate Random String
                RandomString = new string(Enumerable.Repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 5).Select(s => s[random.Next(s.Length)]).ToArray())
            };

            #region Queueing using Queue Collection
            // Uncomment QueueService.Enqueue(() => { ProcessQueue(queue); }) to use .Net Queue Object to Queue Tasks.
            // And Comment ConcurrentQueueService.Enqueue
            QueueService.Enqueue(() => { ProcessQueue(queue); });
            #endregion

            #region Queueing using ConcurrentQueue
            //ConcurrentQueueService.Enqueue(() => { ProcessQueue(queue); });
            #endregion

            Console.WriteLine
            (
                "Enqueued: " + queue.QueueID +
                "\t" + "Producer ThreadID :" + queue.ProducerThreadID +
                "\t" + queue.EnqueueDateTime.ToLongTimeString() +
                "\t" + "RandomString   :" + queue.RandomString
            );
        }
    }
Esempio n. 25
0
 private void ValidateQueueService(QueueService queueService)
 {
     Assert.NotNull(queueService);
     Assert.NotNull(queueService.FrontEndCallbackThreadsCount);
     Assert.NotNull(queueService.FrontEndCpuBasedKeepAliveThrottlingCpuMonitorIntervalInSeconds);
     Assert.NotNull(queueService.FrontEndCpuBasedKeepAliveThrottlingEnabled);
     Assert.NotNull(queueService.FrontEndCpuBasedKeepAliveThrottlingPercentCpuThreshold);
     Assert.NotNull(queueService.FrontEndCpuBasedKeepAliveThrottlingPercentRequestsToThrottle);
     Assert.NotNull(queueService.FrontEndHttpListenPort);
     Assert.NotNull(queueService.FrontEndHttpsListenPort);
     Assert.NotNull(queueService.FrontEndMaxMillisecondsBetweenMemorySamples);
     Assert.NotNull(queueService.FrontEndMemoryThrottleThresholdSettings);
     Assert.NotNull(queueService.FrontEndMemoryThrottlingEnabled);
     Assert.NotNull(queueService.FrontEndMinThreadPoolThreads);
     Assert.NotNull(queueService.FrontEndThreadPoolBasedKeepAliveIOCompletionThreshold);
     Assert.NotNull(queueService.FrontEndThreadPoolBasedKeepAliveMonitorIntervalInSeconds);
     Assert.NotNull(queueService.FrontEndThreadPoolBasedKeepAlivePercentage);
     Assert.NotNull(queueService.FrontEndThreadPoolBasedKeepAliveWorkerThreadThreshold);
     Assert.NotNull(queueService.FrontEndUseSlaTimeInAvailability);
     //Assert.NotNull(queueService.HealthStatus);
     Assert.NotNull(queueService.Id);
     Assert.NotNull(queueService.Location);
     Assert.NotNull(queueService.Name);
     Assert.NotNull(queueService.Type);
     Assert.NotNull(queueService.Version);
 }
Esempio n. 26
0
        public async Task ReleaseHeldMessages()
        {
            var queueConfig = new QueueConfiguration
            {
                QueueName              = QueueName,
                PrefetchCount          = 1,
                OnErrorAction          = QueueConfiguration.ErrorAction.RestartConnection,
                ConsumerTag            = "consumer",
                RetryIntervalInSeconds = 10
            };
            var queue = new QueueService(ExposedRabbitService.validConfig, subscriberlogger.Object);

            queue.Start(queueConfig, handler);
            basicService.ExposedChannel.BasicPublish(ExchangeName, "", true, null, Encoding.UTF8.GetBytes(TestMessages.Exception));
            await Task.Delay(RoundTripWaitTime);

            var freeMessages = basicService.ExposedChannel.MessageCount(QueueName);

            queue.Dispose();
            var finalMessageCount = basicService.ExposedChannel.MessageCount(QueueName);

            processCount.Should().Be(1, "because 1 messages were sent");
            successCount.Should().Be(0, "because 0 successful messages were sent");
            errorCount.Should().Be(1);
            freeMessages.Should().Be(1, "because excepted messages should be released");
            finalMessageCount.Should().Be(1, "because only one message caused exception");
        }
Esempio n. 27
0
        public async Task VerifyQueueService_Get35Messages()
        {
            // Arrange
            IQueueService queueService = new QueueService("UseDevelopmentStorage=true", "testqueue");

            // Act
            var messages = await queueService.GetMessagesAsync(35, TimeSpan.FromHours(1));
        }
Esempio n. 28
0
        public void VerifyQueueService_Creation_Returns_Valid_Instance()
        {
            // Arrange
            IQueueService queueService = new QueueService("UseDevelopmentStorage=true", "testqueue");

            // Assert
            Assert.IsNotNull(queueService);
        }
 public DocRenderFunction(BlobService blob, TableService table, QueueService queue, JobService jobService, MpowerClient renderService)
 {
     _blob          = blob;
     _table         = table;
     _queue         = queue;
     _jobService    = jobService;
     _renderService = renderService;
 }
Esempio n. 30
0
    public void crearcola()
    {
        string queueName        = "MyQueue";
        string queueDescription = "Cola para turnos de partida.";

        queueService = sp.BuildQueueService();
        queueService.CreatePullQueue(queueName, queueDescription, MessageBack);
    }
        protected override void Arrange()
        {
            Cleanup();

            _queueService = new QueueService();
            _queuePath = QueueTestHelper.CreateQueuePathForPrivateQueue(ComputerName, TestQueueName, _isTransactional);
            _queueService.CreateQueue(_queuePath, _isTransactional);
            _messageData = new TestClass1 { IntValue1 = 1, StringValue1 = "string1" };
        }
        public static void CleanupPrivateTestQueues(string computerName, string partialTestQueueName)
        {
            var queueService = new QueueService();
            var privateQueues = queueService.GetPrivateQueues(computerName);

            var testQueues = privateQueues
                .Where(q => q.QueueName.ToLower().Contains(@"private$\" + partialTestQueueName.ToLower()));

            foreach (var queue in testQueues)
            {
                queueService.DeleteQueue(queue.Path);
            }
        }
        protected override void Arrange()
        {
            Cleanup();

            _queueService = new QueueService();
            _queuePath = QueueTestHelper.CreateQueuePathForPrivateQueue(ComputerName, TestQueueName, _isTransactional);
            _queueService.CreateQueue(_queuePath, _isTransactional);

            for (int i = 1; i <= MessageCount; i++)
            {
                var messageData = new TestClass1 { IntValue1 = i, StringValue1 = "string" + i };
                _queueService.CreateMessage(_queuePath, messageData, TestMessagesLabel);
            }
        }
        protected override void Arrange()
        {
            Cleanup();

            _queueService = new QueueService();
            _queuePath = QueueTestHelper.CreateQueuePathForPrivateQueue(ComputerName, TestQueueName, _isTransactional);
            _queueService.CreateQueue(_queuePath, _isTransactional);

            _queueService.CreateMessage(_queuePath, new TestClass1 { StringValue1 = "Should not be deleted" }, TestMessagesLabelForMessageWhichShouldNotBeDeleted);

            _messageData = new TestClass1 { IntValue1 = 1, StringValue1 = "string1" };
            _queueService.CreateMessage(_queuePath, _messageData, TestMessagesLabel);
            
            _messageToDelete = _queueService.GetMessageInfos(_queuePath, TestMessagesLabel).Single();
        }
        public void Test()
        {
            //string chuck = "chuck";

            var service = new QueueService();
            service.Process();

            //TestMethod("chuck", "chuck2", null);

            //var demo = new DemoMessage {FirstName = "Chuck", LastName = "Conway"};

            //IQueue q = new AzureQueue();
            ////q.Send("media", demo);

            //int messageCount = 0;

            //q.ProcessAllMessages<DemoMessage>("media", r => messageCount++);
        }
 public static MessageQueue CreatePrivateQueue(string computerName, string queueName, bool isTransactional)
 {
     var queuePath = CreateQueuePathForPrivateQueue(computerName, queueName, isTransactional);
     var queueService = new QueueService();
     return queueService.CreateQueue(queuePath, isTransactional);
 }
 protected override void Act()
 {
     Result = new QueueService().GetJournalQueue(_journalQueueParent);
 }
 protected override void Act()
 {
     Result = new QueueService().GetPrivateQueues(ComputerName);
 }
        protected override void Arrange()
        {
            Cleanup();

            _queueService = new QueueService();
            _queuePath = QueueTestHelper.CreateQueuePathForPrivateQueue(ComputerName, TestQueueName, _isTransactional);
            _queueService.CreateQueue(_queuePath, _isTransactional);
        }
 public void ShouldReuseExistingQueue()
 {
     var result = new QueueService().GetPrivateQueues(ComputerName);
     Assert.That(result.Count(q => q.QueueName.ToLower().Contains(NameOfNewQueue.ToLower())),
         Is.EqualTo(1));
 }