예제 #1
0
        public async Task DifferentVersions_UpgradeIsCompleted()
        {
            migrationRunnerService.Execute(Arg.Any <SemVersion>(), Arg.Any <SemVersion>()).Returns(true);
            var anyStringArg = Arg.Any <string>();

            settings.TryGetSiteRootDirectory(out anyStringArg).Returns(
                x => {
                x[0] = @"C:\test\umbraco";
                return(true);
            });

            var xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(
                "<configuration>" +
                "<appSettings>" +
                "<add key=\"umbracoConfigurationStatus\" value=\"1.1.1\" />" +
                "</appSettings>" +
                "</configuration>"
                );

            xmlDocumentWrapper.LoadDocument(Arg.Any <string>()).Returns(xmlDoc);

            var deliverable = new UpgradeDeliverable(null, writer, migrationRunnerService,
                                                     MigrationEntryService(new SemVersion(7, 1)), settings, xmlDocumentWrapper);

            var response = await deliverable.Run(null, null);

            Assert.Equal(2, writer.Messages.Count());
            Assert.Equal(DeliverableResponse.Continue, response);
        }
예제 #2
0
        public async Task SameVersions_NothingDone()
        {
            var deliverable = new UpgradeDeliverable(null, writer, null, MigrationEntryService(UmbracoVersion.GetSemanticVersion()), settings, xmlDocumentWrapper);
            var response    = await deliverable.Run(null, null);

            Assert.Single(writer.Messages);
            Assert.Equal(DeliverableResponse.FinishedWithError, response);
        }
예제 #3
0
        public async Task NoMigrationEntries_WillWarnAndExit()
        {
            var deliverable = new UpgradeDeliverable(null, writer, null, MigrationEntryService(), settings, xmlDocumentWrapper);
            var response    = await deliverable.Run(null, null);

            Assert.Single(writer.Messages);
            Assert.Equal(DeliverableResponse.FinishedWithError, response);
        }
예제 #4
0
        public async Task UpgradeFailes_ErrorStateReturned()
        {
            migrationRunnerService.Execute(Arg.Any <SemVersion>(), Arg.Any <SemVersion>()).Returns(false);

            var deliverable = new UpgradeDeliverable(null, writer, migrationRunnerService,
                                                     MigrationEntryService(new SemVersion(7, 1)), settings, xmlDocumentWrapper);

            var response = await deliverable.Run(null, null);

            Assert.Equal(2, writer.Messages.Count());
            Assert.Equal(DeliverableResponse.FinishedWithError, response);
        }