Пример #1
0
        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 });
        }
Пример #2
0
 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);
        }
Пример #4
0
        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 });
        }
Пример #5
0
 public void CanConfigureBackupWriter()
 {
     var writer = new FileBackupWriter("test");
     configuration.UseBackupWriter(writer);
     configuration.BackupWriter.ShouldBe(writer);
 }