예제 #1
0
        protected override void ProcessRecord()
        {
            try
            {
                var courierWebserviceRepositoryProvider = new CourierWebserviceRepositoryProvider
                {
                    Url              = TargetUmbracoUrl,
                    Login            = UmbracoUsername,
                    Password         = UmbracoPassword,
                    PasswordEncoding = UmbracoPasswordEncoding,
                    UserId           = -1,
                    Name             = "webservicerepository"
                };

                var resourcePublisher = new ResourcePublisher(courierWebserviceRepositoryProvider, new PsCmdletLogger(this), PluginFolder);
                resourcePublisher.Publish(RevisionDirectory);
            }
            catch (Exception e)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        e,
                        "UmbracoResources",
                        ErrorCategory.NotSpecified,
                        this
                        )
                    );
            }
        }
        public void WhenRevisionPublished_ThenProviderCalledWithExpectedNumberOfResources()
        {
            var repositoryProviderDouble = new RepositoryProviderDouble();
            var publisher = new ResourcePublisher(repositoryProviderDouble, new PsCmdletLoggerDouble(), @".\UmbracoResources\plugins");

            // fake instatiation in order to load the repository provider into the app domain
            var provider = new CourierWebserviceRepositoryProvider();

            publisher.Publish(@"..\..\ExampleUmbracoRevisions\V1");

            Assert.That(repositoryProviderDouble.ResourcesSeen, Is.EqualTo(113));
        }