예제 #1
0
            public void UpdatePstFileInfo_WhenLastSuccessfulBackupChangeToNull()
            {
                // Arrange
                SUT sut = new SUT(_dbPath);

                sut.Connect();
                string  clientId          = Guid.NewGuid().ToString();
                PstFile pstFileToRegister = new PstFile()
                {
                    LocalPath     = @"C:\Pst Files\Courtel\Archive1.pst",
                    IsSetToBackup = true,
                    Size          = 57_345_786
                };

                // Act
                Assert.IsFalse(sut.IsPstFileExists(clientId, pstFileToRegister.LocalPath));
                sut.RegisterPstFile(clientId, pstFileToRegister);

                pstFileToRegister.LastSuccessfulBackup = DateTime.UtcNow;
                sut.RegisterPstFile(clientId, pstFileToRegister);
                Assert.IsNotNull(sut.GetPstFile(clientId, pstFileToRegister.LocalPath).LastSuccessfulBackup);
                pstFileToRegister.LastSuccessfulBackup = null;
                sut.RegisterPstFile(clientId, pstFileToRegister);
                PstFile updatedPstFile = sut.GetPstFile(clientId, pstFileToRegister.LocalPath);

                // Assert
                Assert.IsNull(updatedPstFile.LastSuccessfulBackup);
            }
예제 #2
0
            public void RegisterRightInformationsFromPstFile_WhenPstFileDoNotExists()
            {
                // Arrange
                SUT sut = new SUT(_dbPath);

                sut.Connect();
                string  clientId          = Guid.NewGuid().ToString();
                PstFile pstFileToRegister = new PstFile()
                {
                    LocalPath            = @"C:\Pst Files\Courtel\Archive1.pst",
                    IsSetToBackup        = true,
                    Size                 = 57_345_786,
                    LastSuccessfulBackup = null
                };

                // Act
                Assert.IsFalse(sut.IsPstFileExists(clientId, pstFileToRegister.LocalPath));
                sut.RegisterPstFile(clientId, pstFileToRegister);
                PstFile insertedPstFile = sut.GetPstFile(clientId, pstFileToRegister.LocalPath);

                // Assert
                Assert.AreEqual(pstFileToRegister.LocalPath, insertedPstFile.LocalPath, true);
                Assert.AreEqual(pstFileToRegister.IsSetToBackup, insertedPstFile.IsSetToBackup);
                Assert.AreEqual(pstFileToRegister.Size, insertedPstFile.Size);
                Assert.AreEqual(pstFileToRegister.LastSuccessfulBackup, insertedPstFile.LastSuccessfulBackup);
            }
예제 #3
0
            public void RegisterThePstFile_WhenPstFileDoNotExists()
            {
                // Arrange
                SUT sut = new SUT(_dbPath);

                sut.Connect();
                string  clientId          = Guid.NewGuid().ToString();
                PstFile pstFileToRegister = new PstFile()
                {
                    LocalPath     = @"C:\Pst Files\Courtel\Archive1.pst",
                    IsSetToBackup = true,
                    Size          = 57_345_786
                };

                // Act
                Assert.IsFalse(sut.IsPstFileExists(clientId, pstFileToRegister.LocalPath));
                sut.RegisterPstFile(clientId, pstFileToRegister);

                // Assert
                Assert.IsTrue(sut.IsPstFileExists(clientId, pstFileToRegister.LocalPath));
            }
예제 #4
0
 /// <summary>
 /// Register, in the database, all informations on the PST file mounted in Outlook
 /// </summary>
 /// <param name="clientId">Unique Id of the client that own the PST file</param>
 /// <param name="backupSession">Informations on the backup session</param>
 public void RegisterPstFile(string clientId, PstFile pstFile)
 {
     Logger.Write(30021, $"Registering the PST file {pstFile.LocalPath}", Logger.MessageSeverity.Debug);
     _reportServerDb.RegisterPstFile(clientId, pstFile);
 }