예제 #1
0
        public void FileExists()
        {
            var dep = new CacheDependencyFile(dm, fullPath);

            Assert.IsTrue(dep.FullPath == fi.FullName);
            Assert.IsTrue(dep.Exists == fi.Exists);
            Assert.IsTrue(dep.LastModified == fi.LastWriteTime);
            Assert.IsFalse(dep.HasExpired);
            Assert.IsFalse(dep.HasChanged());

            dm.File.Exists(Arg.Any <string>()).Returns(false);
            Assert.IsFalse(dep.HasExpired);
            Assert.IsTrue(dep.HasChanged());
        }
예제 #2
0
        public void FileExistAndTimeStampNewer()
        {
            var dep = new CacheDependencyFile(dm, fullPath);

            fi.LastWriteTime = DateTime.Now;

            Assert.IsTrue(dep.HasExpired);
            Assert.IsTrue(dep.HasChanged());
        }
예제 #3
0
        public void FileExistButWasDeleted()
        {
            var dep = new CacheDependencyFile(dm, fullPath);

            dm.File.Exists(Arg.Any <string>()).Returns(false);
            fi.Exists = false;

            Assert.IsFalse(dep.HasExpired);
            Assert.IsTrue(dep.HasChanged());
        }
예제 #4
0
        public void FileExistAndTimeStampOlder()
        {
            var dep = new CacheDependencyFile(dm, fullPath);

            fi.LastWriteTime = fi.LastWriteTime.AddMinutes(-5);

            Assert.IsTrue(dep.LastModified < DateTime.Now);
            Assert.IsFalse(dep.HasExpired);
            Assert.IsTrue(dep.HasChanged());
        }
예제 #5
0
        public void FileNotExists()
        {
            fi.Exists = false;
            dm.File.Exists(Arg.Any <string>()).Returns(false);

            var dep = new CacheDependencyFile(dm, fullPath);

            Assert.IsTrue(dep.LastModified == DateTime.MinValue);
            Assert.IsFalse(dep.HasExpired);
            Assert.IsFalse(dep.HasChanged());
        }
예제 #6
0
        public void FileNotExistButAdded()
        {
            dm.File.Exists(Arg.Any <string>()).Returns(false);
            fi.Exists = false;
            var dep = new CacheDependencyFile(dm, fullPath);

            dm.File.Exists(Arg.Any <string>()).Returns(true);
            fi.Exists        = true;
            fi.LastWriteTime = DateTime.Now;

            Assert.IsTrue(dep.HasExpired);
            Assert.IsTrue(dep.HasChanged());
        }