Fixed failing unit tests.

This commit is contained in:
Daniel Stolt
2015-07-15 22:33:24 +01:00
parent 60c546dd7c
commit 551ffb1252

View File

@@ -16,6 +16,9 @@ using Orchard.Recipes.Services;
using Orchard.Services;
using Orchard.Tests.Stubs;
using Orchard.Recipes.Events;
using Orchard.Data;
using System;
using System.Linq.Expressions;
namespace Orchard.Tests.Modules.Recipes.Services {
[TestFixture]
@@ -83,6 +86,7 @@ namespace Orchard.Tests.Modules.Recipes.Services {
builder.RegisterType<RecipeParser>().As<IRecipeParser>();
builder.RegisterType<StubWebSiteFolder>().As<IWebSiteFolder>();
builder.RegisterType<CustomRecipeHandler>().As<IRecipeHandler>();
builder.RegisterInstance(new StubRecipeStepResultRecordRepository()).As<IRepository<RecipeStepResultRecord>>();
_container = builder.Build();
_recipeManager = _container.Resolve<IRecipeManager>();
@@ -163,6 +167,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;