public void LocateFile_ErrorMessageProvidedAndFileNoteFound_WouldShowErrorReport() { var locator = new FileLocator(new[] {"bogus"}); ErrorReport.IsOkToInteractWithUser = false; Assert.Throws<ErrorReport.ProblemNotificationSentToUserException>(() => { locator.LocateFile("foo.txt", "booo hooo"); }); }
public void Setup() { var library = new Moq.Mock<CollectionSettings>(); library.SetupGet(x => x.IsSourceCollection).Returns(false); library.SetupGet(x => x.Language2Iso639Code).Returns("en"); library.SetupGet(x => x.Language1Iso639Code).Returns("xyz"); library.SetupGet(x => x.XMatterPackName).Returns("Factory"); ErrorReport.IsOkToInteractWithUser = false; _fileLocator = new FileLocator(new string[] { FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"), FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates"), FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates", "Basic Book"), FileLocator.GetDirectoryDistributedWithApplication( "BloomBrowserUI"), FileLocator.GetDirectoryDistributedWithApplication("BloomBrowserui/bookLayout"), FileLocator.GetDirectoryDistributedWithApplication( "xMatter") }); _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), new CollectionSettings()), library.Object); _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection"); _libraryFolder = new TemporaryFolder("BookStarterTests_LibraryCollection"); Browser.SetUpXulRunner(); }
public void Setup() { _folder = new TemporaryFolder("BookCollectionTests"); // _fileLocator = new BloomFileLocator(new CollectionSettings(), new XMatterPackFinder(new string[]{}), new string[] { FileLocator.GetDirectoryDistributedWithApplication("root"), FileLocator.GetDirectoryDistributedWithApplication("factoryCollections") }); _fileLocator = new FileLocator(new string[] { FileLocator.GetDirectoryDistributedWithApplication("BloomBrowserUI"), FileLocator.GetDirectoryDistributedWithApplication("browserui/bookCSS"), FileLocator.GetDirectoryDistributedWithApplication("factoryCollections") }); // _vernacularLibraryCollection = new BookCollection(_folder.Path, BookCollection.CollectionType.TheOneEditableCollection, BookFactory, // BookStorageFactory, null, null, new CreateFromSourceBookCommand(), new EditBookCommand()); _vernacularLibraryCollection = new Moq.Mock<BookCollection>(); _bookInfoList = new List<Bloom.Book.BookInfo>(); _vernacularLibraryCollection.Setup(x => x.GetBookInfos()).Returns(_bookInfoList); _storeCollectionList = new Mock<SourceCollectionsList>(); _storeCollectionList.Setup(x => x.GetSourceCollections()).Returns(() => GetStoreCollections()); _librarySettings = new Mock<CollectionSettings>(); _librarySettings.Setup(x => x.CollectionName).Returns(() => "Foo"); }
public void Setup() { ErrorReport.IsOkToInteractWithUser = false; _fileLocator = new FileLocator(new string[] { FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"), FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates", "Basic Book"), FileLocator.GetDirectoryDistributedWithApplication( "xMatter") }); _fixtureFolder = new TemporaryFolder("BloomBookStorageTest"); _folder = new TemporaryFolder(_fixtureFolder,"theBook"); _bookPath = _folder.Combine("theBook.htm"); }
public void Setup() { _librarySettings = new Moq.Mock<CollectionSettings>(); _librarySettings.SetupGet(x => x.IsSourceCollection).Returns(false); _librarySettings.SetupGet(x => x.Language1Iso639Code).Returns("xyz"); _librarySettings.SetupGet(x => x.Language2Iso639Code).Returns("fr"); _librarySettings.SetupGet(x => x.Language3Iso639Code).Returns("es"); _librarySettings.SetupGet(x => x.XMatterPackName).Returns("Factory"); ErrorReport.IsOkToInteractWithUser = false; _fileLocator = new FileLocator(new string[]{}); foreach (var location in ProjectContext.GetFileLocations()) { _fileLocator.AddPath(location); } // new FileLocator(new string[] // { // FileLocator.GetDirectoryDistributedWithApplication("BloomBrowserUI"), // FileLocator.GetDirectoryDistributedWithApplication("browserui/bookCSS"), // FileLocator.GetDirectoryDistributedWithApplication("xMatter"), // FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"), // FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates"), // FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections", "Templates", "Basic Book"), // FileLocator.GetDirectoryDistributedWithApplication( "xMatter", "Factory-XMatter") // }); _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), new CollectionSettings()), _librarySettings.Object); _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection"); _projectFolder = new TemporaryFolder("BookStarterTests_ProjectCollection"); }
public void LocateFile_FileNoteFound_ReturnsEmptyString() { var locator = new FileLocator(new[] { "bogus" }); ErrorReport.IsOkToInteractWithUser = false; Assert.IsEmpty(locator.LocateFile("foo.txt")); }
public void Setup() { _librarySettings = new Moq.Mock<CollectionSettings>(); _librarySettings.SetupGet(x => x.IsSourceCollection).Returns(false); _librarySettings.SetupGet(x => x.Language1Iso639Code).Returns("xyz"); _librarySettings.SetupGet(x => x.Language2Iso639Code).Returns("fr"); _librarySettings.SetupGet(x => x.Language3Iso639Code).Returns("es"); _librarySettings.SetupGet(x => x.XMatterPackName).Returns("Factory"); ErrorReport.IsOkToInteractWithUser = false; _projectFolder = new TemporaryFolder("BookStarterTests_ProjectCollection"); var collectionSettings = new CollectionSettings(Path.Combine(_projectFolder.Path, "test.bloomCollection")); var xmatterFinder = new XMatterPackFinder(new []{FileLocator.GetDirectoryDistributedWithApplication("xMatter")}); _fileLocator = new BloomFileLocator(collectionSettings, xmatterFinder, ProjectContext.GetFactoryFileLocations(), ProjectContext.GetFoundFileLocations()); _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), collectionSettings), _librarySettings.Object); _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection"); }