public void ExecuteRecipeStepNeedsNameTest() { _folders.Manifests.Add("SuperWiki", @" Name: SuperWiki Version: 1.0.3 OrchardVersion: 1 Features: SuperWiki: Description: My super wiki module for Orchard. "); ModuleRecipeHandler moduleRecipeHandler = _container.Resolve <ModuleRecipeHandler>(); RecipeContext recipeContext = new RecipeContext { RecipeStep = new RecipeStep { Name = "Module", Step = new XElement("SuperWiki") } }; recipeContext.RecipeStep.Step.Add(new XAttribute("repository", "test")); Assert.Throws(typeof(InvalidOperationException), () => moduleRecipeHandler.ExecuteRecipeStep(recipeContext)); }
public void ExecuteRecipeStepWithRepositoryAndVersionNotLatestTest() { _packagesInRepository.AddPublishedPackage(new PublishedPackage { Id = "Orchard.Module.SuperWiki", PackageType = DefaultExtensionTypes.Module, Title = "SuperWiki", Version = "1.0.3", IsLatestVersion = true, }); _packagesInRepository.AddPublishedPackage(new PublishedPackage { Id = "Orchard.Module.SuperWiki", PackageType = DefaultExtensionTypes.Module, Title = "SuperWiki", Version = "1.0.2", IsLatestVersion = false, }); ModuleRecipeHandler moduleRecipeHandler = _container.Resolve <ModuleRecipeHandler>(); RecipeContext recipeContext = new RecipeContext { RecipeStep = new RecipeStep { Name = "Module", Step = new XElement("SuperWiki") } }; recipeContext.RecipeStep.Step.Add(new XAttribute("packageId", "Orchard.Module.SuperWiki")); recipeContext.RecipeStep.Step.Add(new XAttribute("repository", "test")); recipeContext.RecipeStep.Step.Add(new XAttribute("version", "1.0.2")); moduleRecipeHandler.ExecuteRecipeStep(recipeContext); var installedPackage = _packageManager.GetInstalledPackages().FirstOrDefault(info => info.ExtensionName == "Orchard.Module.SuperWiki"); Assert.That(installedPackage, Is.Not.Null); Assert.That(installedPackage.ExtensionVersion, Is.EqualTo("1.0.2")); Assert.That(recipeContext.Executed, Is.True); }