Updating UT handlers.

--HG--
branch : 1.x
This commit is contained in:
andrerod
2010-12-29 17:56:50 +00:00
parent a1ea9c307c
commit c5147e5019
6 changed files with 10 additions and 18 deletions

View File

@@ -4,13 +4,9 @@ using Orchard.Tests.ContentManagement.Models;
namespace Orchard.Tests.ContentManagement.Handlers { namespace Orchard.Tests.ContentManagement.Handlers {
public class AlphaPartHandler : ContentHandler { public class AlphaPartHandler : ContentHandler {
public AlphaPartHandler() { public AlphaPartHandler() {
OnGetDisplayShape<AlphaPart>((ctx, part) => ctx.Shape.Zones["Main"].Add(part, "3")); Filters.Add(new ActivatingFilter<AlphaPart>("alpha"));
}
protected override void Activating(ActivatingContentContext context) { OnGetDisplayShape<AlphaPart>((ctx, part) => ctx.Shape.Zones["Main"].Add(part, "3"));
if (context.ContentType == "alpha") {
context.Builder.Weld<AlphaPart>();
}
} }
} }
} }

View File

@@ -3,10 +3,8 @@ using Orchard.Tests.ContentManagement.Models;
namespace Orchard.Tests.ContentManagement.Handlers { namespace Orchard.Tests.ContentManagement.Handlers {
public class BetaPartHandler : ContentHandler { public class BetaPartHandler : ContentHandler {
protected override void Activating(ActivatingContentContext context) { public BetaPartHandler() {
if (context.ContentType == "beta") { Filters.Add(new ActivatingFilter<BetaPart>("beta"));
context.Builder.Weld<BetaPart>();
}
} }
} }
} }

View File

@@ -6,7 +6,7 @@ using Orchard.Tests.ContentManagement.Records;
namespace Orchard.Tests.ContentManagement.Handlers { namespace Orchard.Tests.ContentManagement.Handlers {
public class DeltaPartHandler : ContentHandler { public class DeltaPartHandler : ContentHandler {
public DeltaPartHandler(IRepository<DeltaRecord> repository) { public DeltaPartHandler(IRepository<DeltaRecord> repository) {
Filters.Add(new ActivatingFilter<DeltaPart>(x => x == "delta")); Filters.Add(new ActivatingFilter<DeltaPart>("delta"));
Filters.Add(StorageFilter.For(repository)); Filters.Add(StorageFilter.For(repository));
} }
} }

View File

@@ -5,7 +5,7 @@ using Orchard.Tests.ContentManagement.Models;
namespace Orchard.Tests.ContentManagement.Handlers { namespace Orchard.Tests.ContentManagement.Handlers {
public class EpsilonPartHandler : ContentHandler { public class EpsilonPartHandler : ContentHandler {
public EpsilonPartHandler(IRepository<EpsilonRecord> repository) { public EpsilonPartHandler(IRepository<EpsilonRecord> repository) {
Filters.Add(new ActivatingFilter<EpsilonPart>(x => x == "gamma")); Filters.Add(new ActivatingFilter<EpsilonPart>("gamma"));
Filters.Add(StorageFilter.For(repository)); Filters.Add(StorageFilter.For(repository));
} }
} }

View File

@@ -4,12 +4,10 @@ using Orchard.Tests.ContentManagement.Models;
namespace Orchard.Tests.ContentManagement.Handlers { namespace Orchard.Tests.ContentManagement.Handlers {
public class FlavoredPartHandler : ContentHandler { public class FlavoredPartHandler : ContentHandler {
public FlavoredPartHandler() { public FlavoredPartHandler() {
Filters.Add(new ActivatingFilter<FlavoredPart>("alpha"));
Filters.Add(new ActivatingFilter<FlavoredPart>("beta"));
OnGetDisplayShape<FlavoredPart>((ctx, part) => ctx.Shape.Zones["Main"].Add(part)); OnGetDisplayShape<FlavoredPart>((ctx, part) => ctx.Shape.Zones["Main"].Add(part));
} }
protected override void Activating(ActivatingContentContext context) {
if (context.ContentType == "beta" || context.ContentType == "alpha") {
context.Builder.Weld<FlavoredPart>();
}
}
} }
} }

View File

@@ -6,7 +6,7 @@ using Orchard.Tests.ContentManagement.Records;
namespace Orchard.Tests.ContentManagement.Handlers { namespace Orchard.Tests.ContentManagement.Handlers {
class GammaPartHandler : ContentHandler { class GammaPartHandler : ContentHandler {
public GammaPartHandler(IRepository<GammaRecord> repository) { public GammaPartHandler(IRepository<GammaRecord> repository) {
Filters.Add(new ActivatingFilter<GammaPart>(x => x == "gamma")); Filters.Add(new ActivatingFilter<GammaPart>("gamma"));
Filters.Add(StorageFilter.For(repository)); Filters.Add(StorageFilter.For(repository));
} }
} }