Esempio n. 1
0
        public void AddRangeTestNullCheck()
        {
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => Extensions.AddRange(null, new Dictionary <Object, Object>());

            test.ShouldThrow <NullReferenceException>();
        }
Esempio n. 2
0
        public void AddRangeTestNullCheck1()
        {
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => Extensions.AddRange(new List <String>(), null);

            test.ShouldThrow <NullReferenceException>();
        }
Esempio n. 3
0
        public void AddRangeTestNullCheck()
        {
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => Extensions.AddRange(null, "test0", "test1", "test2");

            test.ShouldThrow <NullReferenceException>();
        }
Esempio n. 4
0
        public void AddRangeTest1()
        {
            var c = new List <String>();

            var result = Extensions.AddRange(c, new List <String> {
                "test0", "test1", "test2"
            });

            Assert.Equal(3, c.Count);
            Assert.Same(c, result);
        }
Esempio n. 5
0
        internal static IEnumerable <SquareCoordinate> GetAllInBetweenSquares(this SquareCoordinate startingCoordinate, SquareCoordinate endingCoordinate)
        {
            var ret = new List <SquareCoordinate>();

            if (startingCoordinate.IsOnDiagonal(endingCoordinate))
            {
                Extensions.AddRange(ret, GetDiagonalInBetweenPositions(startingCoordinate, endingCoordinate));
            }
            if (startingCoordinate.IsOnRankOrFile(endingCoordinate))
            {
                Extensions.AddRange(ret, GetStraightInBetweenPosition(startingCoordinate, endingCoordinate));
            }

            return(ret);
        }
Esempio n. 6
0
        public void RefreshPackageList(bool showInstalledOnly = false)
        {
            var window = new BackgroundWorkerWaitWindow("Loading Extensions", $"Loading extensions from the InRule Extension Exchange service...");

            window.DoWork += delegate(object sender, DoWorkEventArgs args)
            {
                Debug.WriteLine("In refresh packages Task");

                var packages = repository.Repositories.First(x => x.Source == Settings.FeedUrl).GetPackages()
                               .Where(x => x.Tags.Contains("extension"))
                               .ToList()
                               .GroupBy(x => x.Id, (id, packs) =>
                {
                    SemanticVersion latestVersion;
                    latestVersion           = packs.Max(v => v.Version);
                    IPackage currentPackage = PackageManager.LocalRepository.FindPackage(id);
                    return(new ExtensionRowViewModel
                    {
                        UpdateAvailable = currentPackage != null && !currentPackage.IsLatestVersion,
                        IsInstalled = currentPackage != null,
                        LatestVersion = latestVersion.ToNormalizedString(),
                        InstalledVersion = currentPackage == null ? "--" : currentPackage.Version.ToNormalizedString(),
                        Package = packs.First(p => p.Id == id)
                    });
                })
                               .ToList()
                               .Where(x => !showInstalledOnly || x.IsInstalled);

                args.Result = packages;
            };
            window.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs args)
            {
                Debug.WriteLine("Got packages.");
                if (args.Error == null)
                {
                    Extensions.Clear();
                    Extensions.AddRange((IEnumerable <ExtensionRowViewModel>)args.Result);
                }
                else
                {
                    Debug.WriteLine(args.Error.ToString());
                    MessageBox.Show(args.Error.ToString());
                    throw args.Error;
                }
            };
            window.ShowDialog();
        }
Esempio n. 7
0
        private void GetExtensionsFromSettings(string name, IList <string> defaultExtensions)
        {
            DefaultExtensions.Clear();
            Extensions.Clear();
            if (defaultExtensions != null)
            {
                DefaultExtensions.AddRange(defaultExtensions);
                Extensions.AddRange(defaultExtensions);
            }

            if (!string.IsNullOrEmpty(name))
            {
                string addKey = "Add" + CultureInfo.InvariantCulture.TextInfo.ToTitleCase(name) + "Extensions";
                string remKey = "Rem" + CultureInfo.InvariantCulture.TextInfo.ToTitleCase(name) + "Extensions";

                if (GrepSettings.Instance.ContainsKey(addKey))
                {
                    string csv = GrepSettings.Instance.Get <string>(addKey).Trim();
                    if (!string.IsNullOrWhiteSpace(csv))
                    {
                        foreach (string extension in csv.Split(','))
                        {
                            var ext = extension.Trim().ToLower();
                            Extensions.Add(ext);
                        }
                    }
                }

                if (GrepSettings.Instance.ContainsKey(remKey))
                {
                    string csv = GrepSettings.Instance.Get <string>(remKey).Trim();
                    if (!string.IsNullOrWhiteSpace(csv))
                    {
                        foreach (string extension in csv.Split(','))
                        {
                            var ext = extension.Trim().ToLower();
                            if (Extensions.Contains(ext))
                            {
                                Extensions.Remove(ext);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 8
0
 void m_initialize()
 {
     // at this point RawData is not null
     try {
         Decode(RawData);
         RequestType = X509CertificateRequestType.PKCS10;
     } catch {
         X509CertificateRequestCmc cmc = new X509CertificateRequestCmc(RawData);
         Version     = cmc.Content.Version;
         SubjectName = cmc.Content.SubjectName;
         PublicKey   = cmc.Content.PublicKey;
         Extensions.AddRange(cmc.Content.Extensions.Cast <X509Extension>());
         Attributes.AddRange(cmc.Content.Attributes);
         SignatureAlgorithm = cmc.Content.SignatureAlgorithm;
         SignatureIsValid   = cmc.Content.SignatureIsValid;
         ExternalData       = cmc;
         RequestType        = X509CertificateRequestType.PKCS7;
     }
 }
Esempio n. 9
0
        public void AddRange()
        {
            var collection = new List <int>();

            // Adds and returns the number of added items
            Assert.AreEqual(4, Extensions.AddRange(collection, new[] { 0, 1, 2, 3 }));
            Assert.AreEqual(4, collection.Count);
            // Adds and allows to iterate over the items as they are added
            Assert.IsTrue(collection.AddRangeEnumerable(new[] { 10, 20, 30 }).SequenceEqual(new[] { 10, 20, 30 }));
            var count = collection.Count;

            Assert.AreEqual(7, count);
            foreach (var item in collection.AddRangeEnumerable(new[] { 100, 200, 300 }))
            {
                GC.KeepAlive(item);
                count++;
                Assert.AreEqual(count, collection.Count);
            }
            Assert.IsTrue(collection.SequenceEqual(new[] { 0, 1, 2, 3, 10, 20, 30, 100, 200, 300 }));
        }
Esempio n. 10
0
 /// <summary>
 /// This method hooks up the click of the associated menu item in the
 /// BIDSHelperPackage.vsct file with the Exec method in this plugin.
 /// </summary>
 /// <param name="commandId">The ordinal of this commandID has to match the id in the BIDSHelperPackage.vsct file</param>
 /// <param name="extension">This menu item will only display for files that match one of the entries in this array of extensions (eg ".cube")</param>
 public void CreateContextMenu(CommandList commandId, string[] extensions)
 {
     Extensions.AddRange(extensions);
     CreateMenu(CommandSet, (int)commandId);
 }
Esempio n. 11
0
 internal void MergeWith(ModuleDescription module)
 {
     Dependencies.AddRange(module.Dependencies);
     Extensions.AddRange(module.Extensions);
 }
Esempio n. 12
0
 protected FileType AddExtensions(params string[] extensions)
 {
     Extensions.AddRange(extensions);
     return(this);
 }