Added specflow 'given' to create a containable content type.

--HG--
branch : dev
This commit is contained in:
Dave Reed
2011-03-17 18:15:13 -07:00
parent 00c3cfc803
commit a1925e9644

View File

@@ -1,4 +1,7 @@
using System.Linq;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.Core.Contents.Extensions;
using Orchard.Environment.Configuration;
using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models;
@@ -59,6 +62,20 @@ namespace Orchard.Specs.Bindings {
}
[Given(@"I have a containable content type ""(.*)\""")]
public void GivenIHaveAContainableContentType(string name) {
var webApp = Binding<WebAppHosting>();
webApp.Host.Execute(() => {
using (var environment = MvcApplication.CreateStandaloneEnvironment("Default")) {
var cdm = environment.Resolve<IContentDefinitionManager>();
var contentTypeDefinition = new ContentTypeDefinition(name, name);
cdm.StoreTypeDefinition(contentTypeDefinition);
cdm.AlterTypeDefinition(name, cfg => cfg.WithPart("CommonPart").WithPart("BodyPart").WithPart("RoutePart").WithPart("ContainablePart").Creatable().Draftable());
}
});
}
[Given(@"I have tenant ""(.*)\"" on ""(.*)\"" as ""(.*)\""")]
public void GivenIHaveTenantOnSiteAsName(string shellName, string hostName, string siteName) {
var webApp = Binding<WebAppHosting>();