public void CanWriteSameDocumentTwice() { var writer = new FileBackupWriter("."); writer.Write("jacob.bak", new byte[] { 1, 2, 3 }); Should.NotThrow(() => writer.Write("jacob.bak", new byte[] { 1, 2, 3 })); var bytes = File.ReadAllBytes("jacob.bak"); bytes.ShouldBe(new byte[] { 1, 2, 3 }); }
public void ConcurrentWritesDoNotFail() { using (File.Create("jacob.bak")) { var writer = new FileBackupWriter("."); Should.NotThrow(() => writer.Write("jacob.bak", new byte[] { 1, 2, 3 })); } }
public void WritesToFile() { var writer = new FileBackupWriter("."); writer.Write("hans.bak", new byte[] { 1, 2, 3 }); var bytes = File.ReadAllBytes("hans.bak"); bytes.ShouldBe(new byte[] { 1, 2, 3 }); }