Ejemplo n.º 1
0
 public void FileChangeEntryTest()
 {
     NinjectReg = new Registrator();
     var LogEngine = NinjectReg.kernel.Get<LogEngine>();
     try
     {
         LogEngine.CreateFileChangeLog(5, "Test");
         Assert.IsTrue(true);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.ToString());
         Assert.IsTrue(false);
     }
 }
Ejemplo n.º 2
0
        public void CommitEntryTest()
        {
            NinjectReg = new Registrator();
            var LDAL = NinjectReg.kernel.Get<LogEngine>();
            var log = LDAL.CreateErrorLog("Test", 0, "Test", 0);

            try
            {
                LDAL.CommitLog(log);
                Assert.IsTrue(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 3
0
        public void CreateErrorLogTest()
        {
            NinjectReg = new Registrator();
            var LogManager = NinjectReg.kernel.Get<LogManager>();

            try
            {
                LogManager.CreateErrorLog("exception (unit test)", 8, "dev/unit.test", 4);
                Assert.IsTrue(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 4
0
        public void FileManagerSyncTest()
        {
            NinjectReg = new Registrator();
            var FileEngine = NinjectReg.kernel.Get<FileEngine>();

            var sDir = @"C:\testSource";
            var tDir = @"C:\NewTar";
            var filter = FileEngine.CreateFilter();
            var options = FileEngine.SetOptions();
            FileEngine.CheckTargetDirExists(tDir);
            var SourceProvider = FileEngine.CreateProvider(sDir, filter, options);
            var DestinationProvider = FileEngine.CreateProvider(tDir, filter, options);
            FileEngine.DetectChanges(SourceProvider);
            SourceProvider = FileEngine.CreateProvider(sDir, filter, options);
            SourceProvider = FileEngine.SetPreviewModeFlag(SourceProvider, true);
            DestinationProvider = FileEngine.SetPreviewModeFlag(DestinationProvider, true);
            DestinationProvider = FileEngine.AttachApplyingChangeEventHandler(DestinationProvider);
            DestinationProvider = FileEngine.AttachAppliedChangeEventHandler(DestinationProvider);
            DestinationProvider = FileEngine.AttachSkippedChangeEventHandler(DestinationProvider);
            var agent = FileEngine.CreateSyncOrchestrator(SourceProvider,DestinationProvider);
            agent = FileEngine.SetSyncDirection(agent);
            FileEngine.Synchronize(agent);
        }
Ejemplo n.º 5
0
 public void SyncTest()
 {
     NinjectReg = new Registrator();
     var FileEngine = NinjectReg.kernel.Get<FileEngine>();
 }
Ejemplo n.º 6
0
 public void ExecuteQuery()
 {
     NinjectReg = new Registrator();
     var LogEngine = NinjectReg.kernel.Get<LogEngine>();
     var query = LogEngine.CreateQuery();
     LogEngine.ExecuteQuery(query);
 }
Ejemplo n.º 7
0
        public void BigTest()
        {
            NinjectReg = new Registrator();
            var FileEngine = NinjectReg.kernel.Get<FileEngine>();

            FileSyncProvider sourceProvider = null;
            FileSyncProvider destinationProvider = null;

            try
            {
                sourceProvider = new FileSyncProvider(
                    @"C:\testSource", null, FileEngine.SetOptions());
                destinationProvider = new FileSyncProvider(
                    @"C:\targetDir", null, FileEngine.SetOptions());

                SyncOrchestrator agent = new SyncOrchestrator();
                agent.LocalProvider = sourceProvider;
                agent.RemoteProvider = destinationProvider;
                agent.Direction = SyncDirectionOrder.Upload; // Sync source to destination

                Console.WriteLine("Synchronizing changes to replica: " +
                    destinationProvider.RootDirectoryPath);
                //agent.Synchronize();
                Assert.IsTrue(true);
            }
            finally
            {
                // Release resources
                if (sourceProvider != null) sourceProvider.Dispose();
                if (destinationProvider != null) destinationProvider.Dispose();
            }
        }
Ejemplo n.º 8
0
 public void RegistratorTest()
 {
     NinjectReg = new Registrator();
 }
Ejemplo n.º 9
0
 public void CreateSyncOptionsTest()
 {
     NinjectReg = new Registrator();
     var FileEngine = NinjectReg.kernel.Get<FileEngine>();
     var test = FileEngine.SetOptions();
 }
Ejemplo n.º 10
0
 public void CreateSyncFilterTest()
 {
     NinjectReg = new Registrator();
     var FileEngine = NinjectReg.kernel.Get<FileEngine>();
     var test = FileEngine.CreateFilter();
 }
Ejemplo n.º 11
0
 public void UserNameQuery()
 {
     NinjectReg = new Registrator();
     var LogEngine = NinjectReg.kernel.Get<LogEngine>();
     var query = LogEngine.CreateQuery();
     var options = new SearchOptions { UserName = "******" };
     IEnumerable<History> result = LogEngine.UserNameQuery(query, options);
     foreach (History x in result.ToList())
     {
         if (!(x.UserName == "drmurtha"))
         {
             Assert.IsFalse(true);
             break;
         }
     }
     Assert.IsTrue(true);
 }
Ejemplo n.º 12
0
 public void NinjectLogManagerTest()
 {
     NinjectReg = new Registrator();
     var LogManager = NinjectReg.kernel.Get<LogManager>();
     //var result = LogManager.RunSampleQueries();
     //foreach (History a in result)
     //{
     //    Debug.WriteLine(a.LogTime.ToString() + " " + a.LogDate.ToShortDateString() + ", " + a.LogType.Description.ToString() + ", " + a.InteractionType.Description.ToString() + ", " + a.Domain.ToString() + "\\" + a.UserName.ToString());
     //}
 }
Ejemplo n.º 13
0
 public void LogTypeQuery()
 {
     NinjectReg = new Registrator();
     var LogEngine = NinjectReg.kernel.Get<LogEngine>();
     var query = LogEngine.CreateQuery();
     var options = new SearchOptions { LogTypeId = 5 };
     LogEngine.LogTypeQuery(query, options);
 }
Ejemplo n.º 14
0
 public void FileOperationQuery()
 {
     NinjectReg = new Registrator();
     var LogEngine = NinjectReg.kernel.Get<LogEngine>();
     var query = LogEngine.CreateQuery();
     int operation = 4;
     var options = new SearchOptions {FileOperationId = 4 };
     try
     {
         IEnumerable<History> result = LogEngine.FileOperationQuery(query, options);
         foreach (History x in result.ToList())
         {
             if (!(x.FileOperationId == operation))
             {
                 Assert.IsFalse(true);
                 break;
             }
         }
     }
     catch (Exception e)
     {
         Assert.Fail();
     }
     Assert.IsTrue(true);
 }
Ejemplo n.º 15
0
        public void CreateSyncLogTest()
        {
            NinjectReg = new Registrator();
            var LogManager = NinjectReg.kernel.Get<LogManager>();

            try
            {
                LogManager.CreateSyncLog(4);
                Assert.IsTrue(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
                Assert.IsTrue(false);
            }
        }
Ejemplo n.º 16
0
 public void MultiFilterLogQuery2()
 {
     NinjectReg = new Registrator();
     var LogManager = NinjectReg.kernel.Get<LogManager>();
     var options = new SearchOptions
     {
         LogTypeId = 5,
         FileOperationId = 4,
         UserName = "******",
         StartDate = -6,
         StopDate = 1
     };
     var result = LogManager.PerformQuery(options);
     foreach (History a in result)
     {
         Debug.WriteLine(a.LogTime.ToString() + " " + a.LogDate.ToShortDateString() + ", " + a.LogType.Description.ToString() + ", " + a.InteractionType.Description.ToString() + ", " + a.Domain.ToString() + "\\" + a.UserName.ToString());
     }
 }
Ejemplo n.º 17
0
 public void CreateSyncOrchestratorTest()
 {
     NinjectReg = new Registrator();
     var FileEngine = NinjectReg.kernel.Get<FileEngine>();
     FileEngine.CreateSyncOrchestrator(FileEngine.CreateProvider(@"c:\testSource", FileEngine.CreateFilter(), FileEngine.SetOptions()), FileEngine.CreateProvider(@"c:\testDir", FileEngine.CreateFilter(), FileEngine.SetOptions()));
 }
Ejemplo n.º 18
0
 public void SyncLogEntry()
 {
     NinjectReg = new Registrator();
     var LogEngine = NinjectReg.kernel.Get<LogEngine>();
     var result = LogEngine.CreateQuery();
     Assert.IsInstanceOfType(result, typeof(IEnumerable<History>));
 }
Ejemplo n.º 19
0
 public void DisposeSyncProviderTest()
 {
     NinjectReg = new Registrator();
     var FileEngine = NinjectReg.kernel.Get<FileEngine>();
     var test = FileEngine.CreateProvider(@"c:\testSource", FileEngine.CreateFilter(), FileEngine.SetOptions());
 }
Ejemplo n.º 20
0
 public void SetPreviewModeTest()
 {
     NinjectReg = new Registrator();
     var FileEngine = NinjectReg.kernel.Get<FileEngine>();
     var test = FileEngine.CreateProvider(@"c:\testSource", FileEngine.CreateFilter(), FileEngine.SetOptions());
     test = FileEngine.SetPreviewModeFlag(test, true);
     Assert.IsTrue(test.PreviewMode);
 }
Ejemplo n.º 21
0
 public void DateQuery()
 {
     NinjectReg = new Registrator();
     var LogEngine = NinjectReg.kernel.Get<LogEngine>();
     var query = LogEngine.CreateQuery();
     var options = new SearchOptions
     {
         StartDate = -2,
         StopDate = 0
     };
     IEnumerable<History> result = LogEngine.DateRangeQuery(query,options);
     foreach (History x in result.ToList())
     {
         if (!((x.LogDate >= DateTime.Now.AddDays(-2) && (x.LogDate <= DateTime.Now.AddDays(0)))))
         {
             Assert.IsFalse(true);
             break;
         }
     }
     Assert.IsTrue(true);
 }