Beispiel #1
0
        public void QueueInsert_Nothing_Sent()
        {
            ChangePublisher changePublisher = new ChangePublisher();
            var mockItemDiscoverer = MockTestHelper.MockItemDiscoverer("source root name 1");
            changePublisher.Initialize("source root name 1",mockItemDiscoverer);

            changePublisher.QueueInsert("");

            Assert.IsNull(changePublisher.PublishPackage());
        }
Beispiel #2
0
        public void QueueOneOperationAtATime_Ok()
        {
            ChangePublisher changePublisher = new ChangePublisher();
            var mockItemDiscoverer = MockTestHelper.MockItemDiscoverer("source root name 1");
            changePublisher.Initialize("source root name 1", mockItemDiscoverer);

            changePublisher.QueueInsert("item one");

            _expectedPackageRequestResponse.ChangePushItems = new List<ChangePushItem>
                                                   {
                                                       new ChangePushItem
                                                           {
                                                               AbsolutePath = "item one",
                                                               OperationType = OperationType.Insert
                                                           }
                                                   };
            var actualPackage = changePublisher.PublishPackage();
            CompareTwoPackages(_expectedPackageRequestResponse, actualPackage);
            changePublisher.RemovePackage(actualPackage);
            Assert.IsNull(changePublisher.PublishPackage());

            changePublisher.QueueUpdate("item one");

            _expectedPackageRequestResponse.ChangePushItems = new List<ChangePushItem>
                                                   {
                                                       new ChangePushItem
                                                           {
                                                               AbsolutePath = "item one",
                                                               OperationType = OperationType.Update
                                                           }
                                                   };
            actualPackage = changePublisher.PublishPackage();
            CompareTwoPackages(_expectedPackageRequestResponse, actualPackage);
            changePublisher.RemovePackage(actualPackage);
            Assert.IsNull(changePublisher.PublishPackage());

            changePublisher.QueueDelete("item one");
            _expectedPackageRequestResponse.ChangePushItems = new List<ChangePushItem>
                                                   {
                                                       new ChangePushItem
                                                           {
                                                               AbsolutePath = "item one",
                                                               OperationType = OperationType.Delete
                                                           }
                                                   };
            actualPackage = changePublisher.PublishPackage();
            CompareTwoPackages(_expectedPackageRequestResponse, actualPackage);
            changePublisher.RemovePackage(actualPackage);
            Assert.IsNull(changePublisher.PublishPackage());
        }
Beispiel #3
0
        public void RemovePackage_Ok()
        {
            ChangePublisher changePublisher = new ChangePublisher();
            var mockItemDiscoverer = MockTestHelper.MockItemDiscoverer("source root name 1");

            changePublisher.Initialize("source root name 1",mockItemDiscoverer);

            changePublisher.QueueInsert("item one");

            changePublisher.QueueUpdate("item one");

            _expectedPackageRequestResponse.ChangePushItems = new List<ChangePushItem>
                                                   {
                                                       new ChangePushItem
                                                           {
                                                               AbsolutePath = "item one",
                                                               OperationType = OperationType.Update
                                                           }
                                                   };
            var publishedPackage = changePublisher.PublishPackage();

            CompareTwoPackages(_expectedPackageRequestResponse,publishedPackage);

            Assert.AreEqual(1, changePublisher.PublishedPackageNotDistributed.Count);
            Assert.AreEqual(1,changePublisher.PublishedPackageNotDistributed[0].ChangePushItems.Count);
            Assert.AreEqual(publishedPackage.PackageId,changePublisher.PublishedPackageNotDistributed[0].PackageId);
            changePublisher.RemovePackage(publishedPackage);
            Assert.AreEqual(0,changePublisher.PublishedPackageNotDistributed.Count);
        }
Beispiel #4
0
        public void QueueOperationsSomeDuplicates_NonThreaded_Ok()
        {
            ChangePublisher changePublisher = new ChangePublisher();
            var mockItemDiscoverer = MockTestHelper.MockItemDiscoverer("source root name 1");
            changePublisher.Initialize("source root name 1",mockItemDiscoverer);

            changePublisher.QueueInsert("item one");

            changePublisher.QueueUpdate("item one");

            _expectedPackageRequestResponse.ChangePushItems = new List<ChangePushItem>
                                                   {
                                                       new ChangePushItem
                                                           {
                                                               AbsolutePath = "item one",
                                                               OperationType = OperationType.Update
                                                           }
                                                   };
            CompareTwoPackages(_expectedPackageRequestResponse, changePublisher.PublishPackage());
        }