Ejemplo n.º 1
0
        public async Task FileRenamed()
        {
            _fs.Create(_dir);
            _fs.Create(_file).Dispose();
            var tmpFile = _file.Rename(Guid.NewGuid() + ".txt");

            var renamed = _fs.Watch(_file).Take(1).ToTask();

            _fs.Move(_file, tmpFile);
            Assert.AreEqual(Unit.Default, await renamed.TimeoutAfter(TimeSpan.FromSeconds(2)), "Did not get file moved event!");

            var renamedBack = _fs.Watch(_file).Take(1).ToTask();

            _fs.Move(tmpFile, _file);
            Assert.AreEqual(Unit.Default, await renamedBack.TimeoutAfter(TimeSpan.FromSeconds(2)), "Did not get file moved event!");
        }