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"), BloomFileLocator.GetFactoryBookTemplateDirectory("Basic Book"), BloomFileLocator.GetFactoryBookTemplateDirectory("Wall Calendar"), FileLocator.GetDirectoryDistributedWithApplication( BloomFileLocator.BrowserRoot), BloomFileLocator.GetBrowserDirectory("bookLayout"), BloomFileLocator.GetBrowserDirectory("bookEdit","css"), BloomFileLocator.GetInstalledXMatterDirectory() }); var projectFolder = new TemporaryFolder("BookStarterTests_ProjectCollection"); var collectionSettings = new CollectionSettings(Path.Combine(projectFolder.Path, "test.bloomCollection")); _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), collectionSettings), library.Object); _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection"); _libraryFolder = new TemporaryFolder("BookStarterTests_LibraryCollection"); }
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() { ErrorReport.IsOkToInteractWithUser = false; _fileLocator = new FileLocator(new string[] { //FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"), BloomFileLocator.GetFactoryBookTemplateDirectory("Basic Book"), BloomFileLocator.GetInstalledXMatterDirectory() }); _fixtureFolder = new TemporaryFolder("BloomBookStorageTest"); _folder = new TemporaryFolder(_fixtureFolder, "theBook"); _bookPath = _folder.Combine("theBook.htm"); }
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(BloomFileLocator.BrowserRoot), //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 Mock<BookCollection>(); _bookInfoList = new List<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 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 []{ BloomFileLocator.GetInstalledXMatterDirectory()}); _fileLocator = new BloomFileLocator(collectionSettings, xmatterFinder, ProjectContext.GetFactoryFileLocations(), ProjectContext.GetFoundFileLocations(), ProjectContext.GetAfterXMatterFileLocations()); _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), collectionSettings), _librarySettings.Object); _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection"); }