Ejemplo n.º 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);
            }
Ejemplo n.º 2
0
 public void TestInitialize()
 {
     if (SUT.IsDbExists(_clientDb.GetDbPath))
     {
         System.IO.File.Delete(_clientDb.GetDbPath);
     }
     _clientDb.CreateDb();
 }
Ejemplo n.º 3
0
            public void ReturnTheFileIDOfTheRecord_WhenTheRecordExists()
            {
                // 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";

                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(5, sourceFile, destinationFile);

                // Assert
                Assert.AreEqual(5, _clientDb.GetFileID(sourceFile));
            }
Ejemplo n.º 4
0
            public void TestInitialize()
            {
                System.IO.FileInfo dbFile = new System.IO.FileInfo(_clientDb.GetDbPath);

                if (dbFile.Exists)
                {
                    dbFile.Delete();
                    dbFile.Refresh();
                    Assert.IsFalse(dbFile.Exists);
                }
                _clientDb.CreateDb();
            }
Ejemplo n.º 5
0
 public void TestInitialize()
 {
     if (SUT.IsDbExists(_clientDb.GetDbPath))
     {
         System.IO.File.Delete(_clientDb.GetDbPath);
     }
     _clientDb.CreateDb();
     _clientDb.InsertHash(1, 0, "00000000000000000000000000000000");
     _clientDb.InsertHash(1, 1, "11111111111111111111111111111111");
     _clientDb.InsertHash(1, 2, "22222222222222222222222222222222");
     _clientDb.InsertHash(1, 3, "33333333333333333333333333333333");
     _clientDb.InsertHash(1, 4, "44444444444444444444444444444444");
     _clientDb.InsertHash(1, 5, "55555555555555555555555555555555");
 }
Ejemplo n.º 6
0
            public void ReturnTrue_WhenTheDbFileExists()
            {
                // Arrange
                System.IO.FileInfo dbFile = new System.IO.FileInfo(@"E:\Pst Backup\Test Files\dbTest.sqlite3");

                // Act
                if (dbFile.Exists)
                {
                    dbFile.Delete();
                    dbFile.Refresh();
                    Assert.IsFalse(dbFile.Exists);
                }

                _clientDb.CreateDb();

                // Assert
                Assert.IsTrue(SUT.IsDbExists(dbFile.FullName));
            }
Ejemplo n.º 7
0
            public void TestInitialize()
            {
                if (SUT.IsDbExists(_clientDb.GetDbPath))
                {
                    System.IO.File.Delete(_clientDb.GetDbPath);
                    Assert.IsFalse(SUT.IsDbExists(_clientDb.GetDbPath));
                }
                _clientDb.CreateDb();
                _clientDb.Connect();
                string hash = String.Empty;

                for (int i = 0; i < 120; i++)
                {
                    char c = (char)(48 + (i % 10));
                    hash = new string(c, 32);
                    _clientDb.InsertHashToConnectedDb(1, i, hash);
                }
                _clientDb.Disconnect();
            }
Ejemplo n.º 8
0
            public void ReturnAFileIdDifferentFromZeroAndNotAlreadyUsed_WhenCalled()
            {
                // Arrange
                string sourceFile1      = @"E:\Pst Backup\Pst Files\Année 2008.pst";
                string destinationFile1 = @"\\akio9901lms.ad.fr\Pst Backup\Pst Files\Année 2008.pst.partial";

                string sourceFile2      = @"E:\Pst Backup\Pst Files\Année 2009.pst";
                string destinationFile2 = @"\\akio9901lms.ad.fr\Pst Backup\Pst Files\Année 2009.pst.partial";

                string sourceFile3      = @"E:\Pst Backup\Pst Files\Année 2010.pst";
                string destinationFile3 = @"\\akio9901lms.ad.fr\Pst Backup\Pst Files\Année 2010.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, sourceFile1, destinationFile1);
                _clientDb.RegisterNewPstFile(2, sourceFile2, destinationFile2);
                _clientDb.RegisterNewPstFile(3, sourceFile3, destinationFile3);
                Assert.IsTrue(_clientDb.IsPstFileRegistered(sourceFile1));
                Assert.IsTrue(_clientDb.IsPstFileRegistered(sourceFile2));
                Assert.IsTrue(_clientDb.IsPstFileRegistered(sourceFile3));
                Assert.AreEqual(1, _clientDb.GetFileID(sourceFile1));
                Assert.AreEqual(2, _clientDb.GetFileID(sourceFile2));
                Assert.AreEqual(3, _clientDb.GetFileID(sourceFile3));
                int availableFileID = _clientDb.GetAvailableFileId();

                // Assert
                Assert.AreEqual(4, availableFileID);
            }