public void RunAsync_UsingBlockingCollection_Take_Works()
        {
            var fileGetter = new FileGetter
            {
                DirPath   = _tempDir,
                FileMasks = new List <string> {
                    "*.*"
                },
                SearchOption = SearchOption.AllDirectories
            };

            fileGetter.RunAsync();

            // Consume bc
            while (true)
            {
                string filePath;

                try
                {
                    filePath = fileGetter.FileCollection.Take();
                    Console.WriteLine(filePath);
                }
                catch (InvalidOperationException)
                {
                    if (fileGetter.FileCollection.IsCompleted)
                    {
                        break;
                    }

                    throw;
                }
            }
        }
        public void RunAsync_UsingBlockingCollection_TryTake_Works()
        {
            var fileGetter = new FileGetter
            {
                DirPath   = _tempDir,
                FileMasks = new List <string> {
                    "*.*"
                },
                SearchOption = SearchOption.AllDirectories
            };

            fileGetter.RunAsync();


            while (true)
            {
                string filePath;
                bool   success = fileGetter.FileCollection.TryTake(out filePath);

                if (success)
                {
                    Console.WriteLine(filePath);
                }
                else
                {
                    if (fileGetter.FileCollection.IsCompleted)
                    {
                        break;
                    }

                    Console.WriteLine("Blocking Collection empty");
                }
            }
        }