Exemple #1
0
        public async Task ExportControllerTest__ThumbFalse_AddXmpFile_CreateListToExport()
        {
            var storage = new FakeIStorage(new List <string> {
                "/"
            }, new List <string>
            {
                _appSettings.DatabasePathToFilePath("/test.dng", false),
                _appSettings.DatabasePathToFilePath("/test.xmp", false),
                "/test.dng",
                "/test.xmp"
            });

            var selectorStorage = new FakeSelectorStorage(storage);

            var fileIndexResultsList = new List <FileIndexItem>
            {
                new FileIndexItem
                {
                    FileName        = "test.dng",
                    ParentDirectory = "/",
                    FileHash        = "FileHash",
                    Status          = FileIndexItem.ExifStatus.Ok
                }
            };
            var fakeQuery = new FakeIQuery(fileIndexResultsList);

            var export = new ExportService(fakeQuery, _appSettings, selectorStorage, new FakeIWebLogger());

            var filePaths = await export.CreateListToExport(fileIndexResultsList, false);

            Assert.AreEqual(true, filePaths[0].Contains("test.dng"));
            Assert.AreEqual(true, filePaths[1].Contains("test.xmp"));
        }
Exemple #2
0
        public async Task ExportControllerTest__ThumbFalse_CreateListToExport()
        {
            var selectorStorage       = _serviceProvider.GetRequiredService <ISelectorStorage>();
            var hostFileSystemStorage =
                selectorStorage.Get(SelectorStorage.StorageServices
                                    .HostFilesystem);

            var export = new ExportService(_query, _appSettings, selectorStorage, new FakeIWebLogger());

            var createAnImageNoExif = new CreateAnImageNoExif();

            var item = new FileIndexItem
            {
                FileName        = createAnImageNoExif.FileName,
                ParentDirectory = "/",
                FileHash        = createAnImageNoExif.FileName.Replace(".jpg", "-test"),
                Status          = FileIndexItem.ExifStatus.Ok
            };

            await _query.AddItemAsync(item);

            var fileIndexResultsList = new List <FileIndexItem> {
                item
            };

            var filePaths = await export.CreateListToExport(fileIndexResultsList, false);

            Assert.AreEqual(true, filePaths.FirstOrDefault().Contains(item.FileName));

            Assert.AreEqual(FolderOrFileModel.FolderOrFileTypeList.File,
                            hostFileSystemStorage.IsFolderOrFile(filePaths.FirstOrDefault()));

            hostFileSystemStorage.FileDelete(createAnImageNoExif.FullFilePathWithDate);
        }
Exemple #3
0
        public async Task ExportControllerTest__ThumbTrue_CreateListToExport()
        {
            var selectorStorage = _serviceProvider.GetRequiredService <ISelectorStorage>();

            var export = new ExportService(_query, _appSettings, selectorStorage, new FakeIWebLogger());

            var item = new FileIndexItem
            {
                FileName        = "testFile.jpg",
                ParentDirectory = "/",
                FileHash        = _createAnImage.FileName,
                Status          = FileIndexItem.ExifStatus.Ok
            };

            await _query.AddItemAsync(item);

            var fileIndexResultsList = new List <FileIndexItem> {
                item
            };

            var filePaths = await export.CreateListToExport(fileIndexResultsList, true);

            Assert.AreEqual(true, filePaths.FirstOrDefault().Contains(item.FileHash));
        }