public void ReadFileConcurrently() { _io.Write(FileName, _data); ThreadTestUtils.ParallelExecute( () => { Thread.Sleep(new Random().Next() % 10); byte[] actual = _io.Read(FileName); CollectionAssert.AreEqual(_data, actual); }); }
public void WriteFileConcurrently() { ThreadTestUtils.ParallelExecute( () => { Thread.Sleep(new Random().Next() % 10); _io.Write(FileName, _data); }); CollectionAssert.AreEqual(_data, _io.Read(FileName)); // The file is in the right location Assert.IsTrue(_io.RootDirectory.FileExists(FileName)); }
[Ignore] // TODO: re-enable this, getting mutex timeouts... public void WriteFileConcurrently() { Debug.WriteLine("TEST START: WriteFileConcurrently"); ThreadTestUtils.ParallelExecute( () => { Thread.Sleep(new Random().Next() % 10); _io.Write(FileName, _data); }); CollectionAssert.AreEqual(_data, _io.Read(FileName)); // The file is in the right location Assert.IsTrue(File.Exists(_io.GetFullPath(FileName))); }
[Ignore] // TODO: re-enable this, getting mutex timeouts... public void CreateDirectoriesConcurrently() { Debug.WriteLine("TEST START: CreateDirectoriesConcurrently"); ThreadTestUtils.ParallelExecute( () => { Thread.Sleep(new Random().Next() % 10); using (_io.CreateDirectoriesLockParent("Level1/Level2/Level3")) { } }); string actual = _io.GetFullPath("Level1/Level2/Level3"); Assert.IsTrue(Directory.Exists(actual)); }