Beispiel #1
0
        public AgentBackup(IMetaDBAccess metaDB)
        {
            this.metaDB = metaDB;
            hasher      = new BlockSplitter();

            backup = null;
        }
Beispiel #2
0
        public void getBlocksFromString_ShouldReturnEmptyCollectionAndEmptyExcess_TestStringIsEmpty()
        {
            var expectedBlocks = new string[0];
            var blockSplitter  = new BlockSplitter(getSubstitudeForFileBase(4));

            var actualBlocks = blockSplitter.GetBlocks(string.Empty);

            CollectionAssert.AreEqual(expectedBlocks, actualBlocks);
            Assert.AreEqual(string.Empty, blockSplitter.ExcessText);
        }
Beispiel #3
0
        public void getBlocksFromString_ShouldReturnEmptyCollection_TestStringIsShorterThanOneBlock()
        {
            var testString     = "Short text";
            var expectedBlocks = new string[0];
            var blockSplitter  = new BlockSplitter(getSubstitudeForFileBase(256));

            var actualBlocks = blockSplitter.GetBlocks(testString);

            CollectionAssert.AreEqual(expectedBlocks, actualBlocks);
            Assert.AreEqual(testString, blockSplitter.ExcessText);
        }
Beispiel #4
0
        getBlocksFromString_ShouldReturnTwoBlocksAndContainAnExcessString_TestStringIsShorterThanThreeBlocks()
        {
            var testString     = "ThisTextSux";
            var expectedBlocks = new string[] { "This", "Text" };
            var blockSplitter  = new BlockSplitter(getSubstitudeForFileBase(4));

            var actualBlocks = blockSplitter.GetBlocks(testString);

            CollectionAssert.AreEqual(expectedBlocks, actualBlocks);
            Assert.AreEqual("Sux", blockSplitter.ExcessText);
        }
Beispiel #5
0
        public void getBlocksFromString_ShouldReturnThreeEvenBlocksOfText_TestStringHasExactlyThreeBlocks()
        {
            var testString    = "ThisTexttest";
            var expectedBocks = new string[] { "This", "Text", "test" };
            var blockSplitter = new BlockSplitter(getSubstitudeForFileBase(4));

            var actualBlocks = blockSplitter.GetBlocks(testString);

            CollectionAssert.AreEqual(expectedBocks, actualBlocks);
            Assert.AreEqual(string.Empty, blockSplitter.ExcessText);
        }
Beispiel #6
0
        public void getBlocksFromTwoStrings_ShouldReturnOneAndTwoBlocks_TestStringsContainTwoUnevenlySplittedBlocks()
        {
            var string1        = "ABC";
            var string2        = "DEFGH";
            var expectedBlocks = new string[] { "ABCD", "EFGH" };
            var blockSplitter  = new BlockSplitter(getSubstitudeForFileBase(4));

            var actualBlocks = new List <string>();
            var blocks1      = blockSplitter.GetBlocks(string1, useExcessText: true).ToList();
            var blocks2      = blockSplitter.GetBlocks(string2, useExcessText: true).ToList();

            actualBlocks.AddRange(blocks1);
            actualBlocks.AddRange(blocks2);

            CollectionAssert.AreEqual(expectedBlocks, actualBlocks.ToArray());
            Assert.AreEqual(string.Empty, blockSplitter.ExcessText);
        }
Beispiel #7
0
 public VMwareBackup(IMetaDBAccess metaDB)
 {
     this.metaDB = metaDB;
     hasher      = new BlockSplitter();
 }