public void GetLibraryInfoFromPath_LoadLibraryCalledOnTypeExtensions(string extension) { var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(null, out _, out var provider); var path = $@"C:\Windows\System32\library{extension}"; AddRemoveReferencesSetup.SetupIComLibraryProvider(provider, new ReferenceInfo(Guid.Empty, "Library", path, 1, 1), path, "Library 1.1"); reconciler.GetLibraryInfoFromPath(path); provider.Verify(m => m.LoadTypeLibrary(It.IsAny <string>()), Times.Once); }
public void ViewModelBrowseCommand_BrowsedLibraryAddedToProject() { const string path = @"C:\Windows\System32\library.dll"; const string name = "Library"; const string description = "Library 1.1"; var viewModel = AddRemoveReferencesSetup.ArrangeViewModel(out var dialogFactory, out var libraryProvider); var info = new ReferenceInfo(AddRemoveReferencesSetup.DummyGuidOne, name, path, 1, 1); AddRemoveReferencesSetup.SetupIComLibraryProvider(libraryProvider, info, path, description); dialogFactory.SetupMockedOpenDialog(path, DialogResult.OK); viewModel.BrowseCommand.Execute(null); var expected = viewModel.ProjectReferences.OfType <ReferenceModel>().Last(); Assert.IsTrue(expected.FullPath.Equals(path)); }
public void GetLibraryInfoFromPath_LoadLibraryLoadsModel() { const string path = @"C:\Windows\System32\library.dll"; const string name = "Library"; const string description = "Library 1.1"; var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(null, out _, out var provider); var info = new ReferenceInfo(AddRemoveReferencesSetup.DummyGuidOne, name, path, 1, 1); AddRemoveReferencesSetup.SetupIComLibraryProvider(provider, info, path, description); var model = reconciler.GetLibraryInfoFromPath(path); Assert.Multiple(() => { Assert.AreEqual(model.Guid, AddRemoveReferencesSetup.DummyGuidOne); Assert.AreEqual(model.Name, name); Assert.AreEqual(model.Description, description); Assert.AreEqual(model.FullPath, path); Assert.AreEqual(model.Major, 1); Assert.AreEqual(model.Minor, 1); Assert.IsFalse(model.IsBroken); }); }