예제 #1
0
        public async Task Preflight_Collections_Enabled()
        {
            var metaPreflight = new MetaPreflight(new FakeIQuery(new List <FileIndexItem>
            {
                new FileIndexItem("/test.jpg"),
                new FileIndexItem("/test.dng"),
            }),
                                                  new AppSettings(), new FakeSelectorStorage(
                                                      new FakeIStorage(new List <string>(),
                                                                       new List <string> {
                "/test.jpg", "/test.dng"
            },
                                                                       new [] { CreateAnImage.Bytes, CreateAnImage.Bytes }))
                                                  , new FakeIWebLogger());

            var result = await metaPreflight.Preflight(
                new FileIndexItem("/test.jpg"),
                new[] { "/test.jpg" }, true, true, 0);

            Assert.AreEqual(2, result.fileIndexResultsList.Count);
            Assert.AreEqual(FileIndexItem.ExifStatus.Ok,
                            result.fileIndexResultsList[0].Status);
            Assert.AreEqual(FileIndexItem.ExifStatus.Ok,
                            result.fileIndexResultsList[1].Status);
        }
예제 #2
0
        public async Task Preflight_ReadOnly()
        {
            var metaPreflight = new MetaPreflight(new FakeIQuery(new List <FileIndexItem>
            {
                new FileIndexItem("/readonly/test.jpg")
            }),
                                                  new AppSettings {
                ReadOnlyFolders = new List <string> {
                    "readonly"
                }
            }, new FakeSelectorStorage(
                                                      new FakeIStorage(new List <string>(),
                                                                       new List <string> {
                "/readonly/test.jpg"
            },
                                                                       new [] { CreateAnImage.Bytes, })), new FakeIWebLogger());

            var result = await metaPreflight.Preflight(
                new FileIndexItem("/readonly/test.jpg"),
                new[] { "/readonly/test.jpg" }, true, true, 0);

            Assert.AreEqual(FileIndexItem.ExifStatus.ReadOnly,
                            result.fileIndexResultsList.FirstOrDefault().Status);
            Assert.AreEqual("", result.fileIndexResultsList.FirstOrDefault().Tags);
        }
예제 #3
0
        public async Task Preflight_Deleted()
        {
            var metaPreflight = new MetaPreflight(new FakeIQuery(new List <FileIndexItem>
            {
                new FileIndexItem("/deleted.jpg")
                {
                    Tags = "!delete!"
                }
            }),
                                                  new AppSettings(), new FakeSelectorStorage(
                                                      new FakeIStorage(new List <string>(),
                                                                       new List <string> {
                "/deleted.jpg"
            },
                                                                       new [] { CreateAnImage.Bytes, })), new FakeIWebLogger());

            var result = await metaPreflight.Preflight(
                new FileIndexItem("/deleted.jpg"),
                new[] { "/deleted.jpg" },
                true, true, 0);

            Assert.AreEqual(FileIndexItem.ExifStatus.Deleted,
                            result.fileIndexResultsList.FirstOrDefault().Status);
            Assert.AreEqual("!delete!", result.fileIndexResultsList.FirstOrDefault().Tags);
        }
예제 #4
0
        public async Task Preflight_NotFoundNotInIndex()
        {
            var metaPreflight = new MetaPreflight(new FakeIQuery(), new AppSettings(),
                                                  new FakeSelectorStorage(), new FakeIWebLogger());
            var result = await metaPreflight.Preflight(
                new FileIndexItem("test"),
                new[] { "test" }, true, true, 0);

            Assert.AreEqual(FileIndexItem.ExifStatus.NotFoundNotInIndex,
                            result.fileIndexResultsList.FirstOrDefault().Status);
        }