Example #1
0
        public void Can_GetAll_Success()
        {
            var props    = new { root = @"C:\Repositories\Kasi.Tools.Harvester\test\Kasi.Tools.Harvester.Domain.Tests\Concrete\Repository", pattern = "FileSystemRepoTest.cs", options = System.IO.SearchOption.TopDirectoryOnly };
            var repo     = new FileSystemRepo(props.root, props.pattern, props.options);
            var actual   = repo.GetAll();
            var testfile = actual.FirstOrDefault();

            Assert.IsNotNull(actual);
            Assert.AreEqual(1, actual.Count());
            Assert.AreEqual(Path.Combine(props.root, props.pattern), testfile.FullFilePath);
        }
Example #2
0
        public void Can_GetAll_WithHugeNumbers_Success()
        {
            var props  = new { root = @"C:\tmp", pattern = "*.*", options = System.IO.SearchOption.AllDirectories };
            var repo   = new FileSystemRepo(props.root, props.pattern, props.options);
            var actual = repo.GetAll();

            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count() > 10000);

            log.Variable("actual.Count()", actual.Count());
        }
Example #3
0
        public void Can_CreateNew_WithCompleteConstructor_Success()
        {
            var props  = new { root = @"", pattern = "", options = System.IO.SearchOption.AllDirectories };
            var actual = new FileSystemRepo(props.root, props.pattern, props.options);

            Assert.IsNotNull(actual);

            Assert.AreEqual(props.root, actual.SearchDirectory);
            Assert.AreEqual(props.pattern, actual.SearchPattern);
            Assert.AreEqual(props.options, actual.SearchOptions);
        }
Example #4
0
        public void Can_LoadHashes_Success()
        {
            var props    = new { root = @"C:\Repositories\Kasi.Tools.Harvester\test\Kasi.Tools.Harvester.Domain.Tests\Concrete\Repository", pattern = "FileSystemRepoTest.cs", options = System.IO.SearchOption.TopDirectoryOnly };
            var repo     = new FileSystemRepo(props.root, props.pattern, props.options);
            var files    = repo.GetAll();
            var testfile = files.FirstOrDefault();

            var actual = testfile.LoadHashes();

            Assert.IsTrue(actual);

            Assert.AreEqual(Encryption.GetHash(Path.Combine(props.root, props.pattern)), testfile.FilelPathHash);
        }