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 });
        }
 public void ConcurrentWritesDoNotFail()
 {
     using (File.Create("jacob.bak"))
     {
         var writer = new FileBackupWriter(".");
         Should.NotThrow(() => writer.Write("jacob.bak", new byte[] { 1, 2, 3 }));
     }
 }
示例#3
0
        public void WriteToZipFile()
        {
            var inner = new FileBackupWriter(".");
            var decorator = new ZipBackupDecorator(inner);

            var document = new byte[] { 65, 66, 67 };

            decorator.Write("jacob.bak", document);
        }
        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 CanConfigureBackupWriter()
 {
     var writer = new FileBackupWriter("test");
     configuration.UseBackupWriter(writer);
     configuration.BackupWriter.ShouldBe(writer);
 }