mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-24 05:42:10 +08:00
Merge branch 'dev' into feature/recipesteps
Conflicts: src/Orchard.Tests.Modules/Recipes/Services/RecipeManagerTests.cs src/Orchard.Web/Modules/Orchard.ImportExport/Controllers/AdminController.cs
This commit is contained in:
@@ -19,7 +19,9 @@ using Orchard.Recipes.Services;
|
||||
using Orchard.Services;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Recipes.Events;
|
||||
using Orchard.Tests.ContentManagement;
|
||||
using Orchard.Data;
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Orchard.Tests.Modules.Recipes.Services {
|
||||
[TestFixture]
|
||||
@@ -100,9 +102,7 @@ namespace Orchard.Tests.Modules.Recipes.Services {
|
||||
builder.RegisterType<RecipeParser>().As<IRecipeParser>();
|
||||
builder.RegisterType<StubWebSiteFolder>().As<IWebSiteFolder>();
|
||||
builder.RegisterType<CustomRecipeHandler>().As<IRecipeHandler>();
|
||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||
_session = _sessionFactory.OpenSession();
|
||||
builder.RegisterInstance(new DefaultContentManagerTests.TestSessionLocator(_session)).As<ISessionLocator>();
|
||||
builder.RegisterInstance(new StubRecipeStepResultRecordRepository()).As<IRepository<RecipeStepResultRecord>>();
|
||||
|
||||
_container = builder.Build();
|
||||
_recipeManager = _container.Resolve<IRecipeManager>();
|
||||
@@ -117,7 +117,7 @@ namespace Orchard.Tests.Modules.Recipes.Services {
|
||||
|
||||
[Test]
|
||||
public void HarvestRecipesFailsToFindRecipesWhenCalledWithNotExistingExtension() {
|
||||
var recipes = (List<Recipe>) _recipeHarvester.HarvestRecipes("cantfindme");
|
||||
var recipes = (List<Recipe>)_recipeHarvester.HarvestRecipes("cantfindme");
|
||||
|
||||
Assert.That(recipes.Count, Is.EqualTo(0));
|
||||
}
|
||||
@@ -130,7 +130,7 @@ namespace Orchard.Tests.Modules.Recipes.Services {
|
||||
|
||||
[Test]
|
||||
public void ParseRecipeLoadsRecipeMetaDataIntoModel() {
|
||||
var recipes = (List<Recipe>) _recipeHarvester.HarvestRecipes("Sample1");
|
||||
var recipes = (List<Recipe>)_recipeHarvester.HarvestRecipes("Sample1");
|
||||
Assert.That(recipes.Count, Is.EqualTo(1));
|
||||
|
||||
var sampleRecipe = recipes[0];
|
||||
@@ -149,7 +149,7 @@ namespace Orchard.Tests.Modules.Recipes.Services {
|
||||
Assert.That(recipes.Count, Is.EqualTo(1));
|
||||
|
||||
var sampleRecipe = recipes[0];
|
||||
var recipeSteps = (List<RecipeStep>) sampleRecipe.RecipeSteps;
|
||||
var recipeSteps = (List<RecipeStep>)sampleRecipe.RecipeSteps;
|
||||
|
||||
Assert.That(recipeSteps.Count, Is.EqualTo(9));
|
||||
}
|
||||
@@ -183,6 +183,22 @@ namespace Orchard.Tests.Modules.Recipes.Services {
|
||||
}
|
||||
}
|
||||
|
||||
public class StubRecipeStepResultRecordRepository : IRepository<RecipeStepResultRecord> {
|
||||
private List<RecipeStepResultRecord> _records = new List<RecipeStepResultRecord>();
|
||||
public IQueryable<RecipeStepResultRecord> Table { get { return _records.AsQueryable(); } }
|
||||
public void Copy(RecipeStepResultRecord source, RecipeStepResultRecord target) { }
|
||||
public int Count(Expression<Func<RecipeStepResultRecord, bool>> predicate) { return _records.Count; }
|
||||
public void Create(RecipeStepResultRecord entity) { _records.Add(entity); }
|
||||
public void Delete(RecipeStepResultRecord entity) { _records.Remove(entity); }
|
||||
public IEnumerable<RecipeStepResultRecord> Fetch(Expression<Func<RecipeStepResultRecord, bool>> predicate) { throw new NotImplementedException(); }
|
||||
public IEnumerable<RecipeStepResultRecord> Fetch(Expression<Func<RecipeStepResultRecord, bool>> predicate, Action<Orderable<RecipeStepResultRecord>> order) { throw new NotImplementedException(); }
|
||||
public IEnumerable<RecipeStepResultRecord> Fetch(Expression<Func<RecipeStepResultRecord, bool>> predicate, Action<Orderable<RecipeStepResultRecord>> order, int skip, int count) { throw new NotImplementedException(); }
|
||||
public void Flush() { }
|
||||
public RecipeStepResultRecord Get(Expression<Func<RecipeStepResultRecord, bool>> predicate) { throw new NotImplementedException(); }
|
||||
public RecipeStepResultRecord Get(int id) { throw new NotImplementedException(); }
|
||||
public void Update(RecipeStepResultRecord entity) { }
|
||||
}
|
||||
|
||||
public class StubRecipeScheduler : IRecipeScheduler {
|
||||
private readonly IRecipeStepExecutor _recipeStepExecutor;
|
||||
|
||||
@@ -197,7 +213,7 @@ namespace Orchard.Tests.Modules.Recipes.Services {
|
||||
|
||||
public class CustomRecipeHandler : IRecipeHandler {
|
||||
public static string AttributeValue;
|
||||
public string[] _handles = {"Module", "Theme", "Migration", "Custom1", "Custom2", "Command", "Metadata", "Feature", "Settings"};
|
||||
public string[] _handles = { "Module", "Theme", "Migration", "Custom1", "Custom2", "Command", "Metadata", "Feature", "Settings" };
|
||||
|
||||
public void ExecuteRecipeStep(RecipeContext recipeContext) {
|
||||
if (_handles.Contains(recipeContext.RecipeStep.Name)) {
|
||||
|
||||
Reference in New Issue
Block a user