Example #1
0
 public void PublisherServicePublishAPackage()
 {
     File.Copy(@"Data\File1.xml", @"C:\MySynch.Source.Test.Root\File1.xml",true);
     IPublisherProxy publisherProxy = new PublisherClient();
     publisherProxy.InitiateUsingPort(8765);
     var publishedPackage = publisherProxy.PublishPackage();
     Assert.IsNotNull(publishedPackage);
     Assert.AreEqual("SCIENDO-LAPTOP",publishedPackage.Source);
     Assert.AreEqual(@"C:\MySynch.Source.Test.Root\", publishedPackage.SourceRootName);
     Assert.IsNotNull(publishedPackage.PackageId);
     Assert.IsNotNull( publishedPackage.ChangePushItems);
     Assert.AreEqual(1, publishedPackage.ChangePushItems.Count);
     Assert.AreEqual(@"C:\MySynch.Source.Test.Root\File1.xml", publishedPackage.ChangePushItems[0].AbsolutePath);
     Assert.AreEqual(OperationType.Update, publishedPackage.ChangePushItems[0].OperationType);
     publisherProxy.RemovePackage(publishedPackage);
 }
Example #2
0
 public void PublisherServiceUpAndAccessible()
 {
     IPublisherProxy publisherProxy = new PublisherClient();
     publisherProxy.InitiateUsingPort(8765);
     var publishedPackage = publisherProxy.PublishPackage();
     Assert.IsNull(publishedPackage);
 }
Example #3
0
 public void PublisherStartsWithoutABackupFile()
 {
     if (File.Exists(@"C:\Code\Sciendo\MySynch\MySynch.Publisher\bin\Debug\backup.xml"))
         File.Delete(@"C:\Code\Sciendo\MySynch\MySynch.Publisher\bin\Debug\backup.xml");
     IPublisherProxy publisherProxy = new PublisherClient();
     publisherProxy.InitiateUsingPort(8765);
     var publishedPackage = publisherProxy.PublishPackage();
     Assert.IsNull(publishedPackage);
 }
Example #4
0
        public void PublisherStartsWithABackupFile()
        {
            ServiceController serviceController = new ServiceController("MySynch.Publisher.Debug");
            serviceController.Stop();
            serviceController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));

            File.Copy(@"Data\XMLFile2.xml", @"C:\MySynch.Source.Test.Root\XMLFile2.xml", true);

            File.Copy(@"Data\backup.xml", @"C:\Code\Sciendo\MySynch\MySynch.Publisher\bin\Debug\backup.xml", true);
            serviceController.Start();
            serviceController.WaitForStatus(ServiceControllerStatus.Running,TimeSpan.FromSeconds(10));

            IPublisherProxy publisherProxy = new PublisherClient();
            publisherProxy.InitiateUsingPort(8765);
            var publishedPackage = publisherProxy.PublishPackage();
            Assert.IsNotNull(publishedPackage);
            Assert.AreEqual(5,publishedPackage.ChangePushItems.Count);
            Assert.AreEqual(1,
                            publishedPackage.ChangePushItems.Count(
                                i =>
                                i.OperationType == OperationType.Update &&
                                i.AbsolutePath == @"C:\MySynch.Source.Test.Root\abc\abc def\def feg\abc cba.txt"));
            Assert.AreEqual(1,
                            publishedPackage.ChangePushItems.Count(
                                i =>
                                i.OperationType == OperationType.Insert &&
                                i.AbsolutePath == @"C:\MySynch.Source.Test.Root\XMLFile2.xml"));

            serviceController.Stop();
            serviceController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));
            File.Delete(@"C:\Code\Sciendo\MySynch\MySynch.Publisher\bin\Debug\backup.xml");
            File.Delete(@"C:\MySynch.Source.Test.Root\XMLFile2.xml");
        }