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()); }
public void FileExistAndTimeStampNewer() { var dep = new CacheDependencyFile(dm, fullPath); fi.LastWriteTime = DateTime.Now; Assert.IsTrue(dep.HasExpired); Assert.IsTrue(dep.HasChanged()); }
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()); }
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()); }
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()); }
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()); }