示例#1
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));
            }
示例#2
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);
            }