Beispiel #1
0
        public async Task RemoveScannedFilesByFilePathAsync_OneMatch_RemovesOne()
        {
            // ARRANGE
            string          searchPath = "C:\\foobar.foo";
            var             files      = new Mock <IDataCache <ScannedFile> >();
            var             locations  = new Mock <IDataCache <ScannedLocation> >();
            FileHashService service    = new FileHashService(files.Object, locations.Object);

            files.Setup(t => t.ListData()).Returns(() =>
            {
                return(new List <ScannedFile>()
                {
                    new ScannedFile()
                    {
                        Name = "foo",
                        Path = "C:\\foobar.foo"
                    }
                }.AsQueryable());
            });

            // ACT
            int result = await service.RemoveScannedFilesByFilePathAsync(searchPath);

            // ASSERT
            Assert.AreEqual(1, result, "The number of items removed does not match what was expected.");
        }
Beispiel #2
0
        public async Task RemoveScannedFilesByFilePathAsync_NoMatches_RemovesNothing()
        {
            // ARRANGE
            string          searchPath = "C:\foobar.foo";
            var             files      = new Mock <IDataCache <ScannedFile> >();
            var             locations  = new Mock <IDataCache <ScannedLocation> >();
            FileHashService service    = new FileHashService(files.Object, locations.Object);

            // ACT
            int result = await service.RemoveScannedFilesByFilePathAsync(searchPath);

            // ASSERT
            // ToDo: Fix this test, this will likely be a false positive
            Assert.AreEqual(0, result);
        }