Пример #1
0
        public void UpdateSettings_UpdatesRecentProjectsBasedOnFlag(bool updating)
        {
            var settings   = AddRemoveReferencesSetup.GetNonDefaultReferenceSettings();
            var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(settings);

            var input = settings.GetRecentReferencesForHost("EXCEL.EXE").Select(info =>
                                                                                new ReferenceModel(info, ReferenceKind.Project)
            {
                IsRecent = true
            }).ToList();

            var added  = DummyReferenceInfo;
            var output = input.Union(new[] { new ReferenceModel(added, ReferenceKind.TypeLibrary)
                                             {
                                                 IsReferenced = true
                                             } }).ToList();

            var model = AddRemoveReferencesSetup.ArrangeAddRemoveReferencesModel(output, null, settings);

            reconciler.UpdateSettings(model.Object, updating);

            var actual   = settings.GetRecentReferencesForHost("EXCEL.EXE");
            var expected = (updating ? output : input).Select(reference => reference.ToReferenceInfo()).ToList();

            Assert.AreEqual(updating ? expected.Count : input.Count, actual.Count);
            Assert.IsTrue(expected.All(info => actual.Contains(info)));
        }
Пример #2
0
        public void UpdateSettings_AddsPinnedLibraries()
        {
            var settings   = AddRemoveReferencesSetup.GetDefaultReferenceSettings();
            var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(settings);

            var input = settings.GetPinnedReferencesForHost(null).Select(info =>
                                                                         new ReferenceModel(info, ReferenceKind.TypeLibrary)
            {
                IsPinned = true
            }).ToList();

            var output = input.Union(AddRemoveReferencesSetup.LibraryReferenceInfoList.Select(info =>
                                                                                              new ReferenceModel(info, ReferenceKind.TypeLibrary)
            {
                IsPinned = true
            })).ToList();

            var model = AddRemoveReferencesSetup.ArrangeAddRemoveReferencesModel(output, null, settings);

            reconciler.UpdateSettings(model.Object);

            var actual   = settings.GetPinnedReferencesForHost(null);
            var expected = output.Select(reference => reference.ToReferenceInfo()).ToList();

            Assert.AreEqual(expected.Count, actual.Count);
            Assert.IsTrue(expected.All(info => actual.Contains(info)));
        }
Пример #3
0
        public void UpdateSettings_UpdatesRecentLibrariesBasedOnFlag(bool updating)
        {
            var settings   = AddRemoveReferencesSetup.GetNonDefaultReferenceSettings();
            var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(settings);

            var input = settings.GetRecentReferencesForHost(null).Select(info =>
                                                                         new ReferenceModel(info, ReferenceKind.TypeLibrary)
            {
                IsRecent = true
            }).ToList();

            var added  = new ReferenceInfo(AddRemoveReferencesSetup.DummyGuidOne, "Reference", @"C:\Windows\System32\reference.dll", 1, 0);
            var output = input.Union(new [] { new ReferenceModel(added, ReferenceKind.TypeLibrary)
                                              {
                                                  IsReferenced = true
                                              } }).ToList();

            var model = AddRemoveReferencesSetup.ArrangeAddRemoveReferencesModel(output, null, settings);

            reconciler.UpdateSettings(model.Object, updating);

            var actual   = settings.GetRecentReferencesForHost(null);
            var expected = (updating ? output : input).Select(reference => reference.ToReferenceInfo()).ToList();

            Assert.AreEqual(expected.Count, actual.Count);
            Assert.IsTrue(expected.All(info => actual.Contains(info)));
        }