예제 #1
0
            public void DeleteRows_WhenSourceFileAndDestinationFileMatch()
            {
                // Arrange
                SUT    _clientDb       = new SUT(@"E:\Pst Backup\Test Files\dbForDeletingFile.sqlite3");
                string sourceFile      = @"E:\Pst Backup\Pst Files\Année 2008.pst";
                string destinationFile = @"\\akio9901lms.ad.fr\Pst Backup\Pst Files\Année 2008.pst.partial";

                System.IO.FileInfo dbFile = new System.IO.FileInfo(_clientDb.GetDbPath);

                // Act
                if (dbFile.Exists)
                {
                    dbFile.Delete();
                    dbFile.Refresh();
                    Assert.IsFalse(dbFile.Exists);
                }
                _clientDb.CreateDb();
                _clientDb.RegisterNewPstFile(1, sourceFile, destinationFile);
                Assert.IsTrue(_clientDb.IsPstFileRegistered(sourceFile));
                Assert.IsTrue(_clientDb.GetHashes(1).Count == 0);
                _clientDb.DeletePstFile(sourceFile);

                // Assert
                Assert.IsFalse(_clientDb.IsPstFileRegistered(sourceFile));
                Assert.IsTrue(_clientDb.GetHashes(1).Count == 0);
            }
예제 #2
0
            public void ShrinkTheListOfChunk_WhenTheFileHaveBeenShrink()
            {
                // Arrange
                Assert.AreEqual(120, _clientDb.GetHashes(1).Count);

                // Act
                _clientDb.ShrinkChunkList(1, _chunkSize * 116, _chunkSize);

                // Assert
                Assert.AreEqual(116, _clientDb.GetHashes(1).Count);
            }
예제 #3
0
            public void ReturnTheRightAmountOfHashes_WhenCalled()
            {
                // Arrange
                List <string> _hashes;

                // Act
                _hashes = _clientDb.GetHashes(1);

                // Assert
                Assert.AreEqual(6, _hashes.Count);
            }
예제 #4
0
            public void DoNotCreateHashesInTheDatabase_WhenCalled()
            {
                // Arrange
                string        sourceFile      = @"E:\Pst Backup\Pst Files\Année 2008.pst";
                string        destinationFile = @"\\akio9901lms.ad.fr\Pst Backup\Pst Files\Année 2008.pst.partial";
                List <string> hashes          = new List <string>();

                // Act
                _clientDb.RegisterNewPstFile(1, sourceFile, destinationFile);
                hashes = _clientDb.GetHashes(1);

                // Assert
                Assert.AreEqual(0, hashes.Count);
            }
예제 #5
0
            public void DeleteTheHash_WhenCalled()
            {
                // Arrange
                List <string> hashes;
                string        hash         = String.Empty;
                string        expectedHash = "109487142ACBEDFABDEC123412348907";

                // Act
                for (int i = 0; i < 10; i++)
                {
                    _clientDb.InsertHash(1, i, expectedHash);
                }
                hashes = _clientDb.GetHashes(1);
                Assert.AreEqual(10, hashes.Count);
                hash = hashes[0];
                Assert.AreEqual(expectedHash, hash);
                _clientDb.DeleteHash(1, 0);
                hashes = _clientDb.GetHashes(1);
                hash   = _clientDb.GetHash(1, 0);

                // Assert
                Assert.AreEqual(9, hashes.Count);
                Assert.AreEqual(string.Empty, hash);
            }