public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Parser = new DocumentTypeInfoParser(Configuration);
     ContentType = new DocumentType();
     Info = ContentType.Info;
     typedInfo = (DocumentTypeInfo) Info;
 }
 public void SetUp()
 {
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Candidate = Type = new CodeTypeDeclaration();
     generator = new DocumentTypeInfoGenerator(Configuration);
     documentType = new DocumentType { Info = { Alias = "aClass" } };
     info = (DocumentTypeInfo)documentType.Info;
 }
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     attribute = new CodeAttributeDeclaration("DocumentType");
     generator = new DocumentTypeInfoGenerator(Configuration);
     documentType = new DocumentType
     {
         Info = info = new DocumentTypeInfo {Alias = "aClass"}
     };
 }
 private static void AddAllowedTemplates(CodeTypeDeclaration type, DocumentTypeInfo info)
 {
     if (info.AllowedTemplates.All(String.IsNullOrWhiteSpace))
         return;
     var field = new CodeMemberField(
         typeof (string[]),
         "allowedTemplates"
         );
     var expressions = 
         info.AllowedTemplates
             .NonNullOrWhiteSpace()
             .AsPrimitiveExpressions();
     field.InitExpression = new CodeArrayCreateExpression(
         typeof(string[]),
         expressions
         );
     type.Members.Add(field);
 }
예제 #5
0
 private static void MapDocumentTypeInfo(IContentType umbracoContentType, DocumentTypeInfo info)
 {
     MapInfo(umbracoContentType, info);
     info.AllowedTemplates = umbracoContentType.AllowedTemplates.Select(t => t.Alias).ToList();
     info.DefaultTemplate = umbracoContentType.DefaultTemplate != null ? umbracoContentType.DefaultTemplate.Alias : null;
     info.Master = umbracoContentType.ParentId > -1
                 ? umbracoContentType.ContentTypeComposition.First(cmp => cmp.Id == umbracoContentType.ParentId).Alias
                 : "";
 }
예제 #6
0
 protected bool Equals(DocumentTypeInfo other)
 {
     return AllowedTemplates.NullableSequenceEqual(AllowedTemplates) && string.Equals(DefaultTemplate, other.DefaultTemplate);
 }
예제 #7
0
 public DocumentType()
 {
     Info = new DocumentTypeInfo();
 }
 protected bool Equals(DocumentTypeInfo other)
 {
     return(AllowedTemplates.NullableSequenceEqual(AllowedTemplates) && string.Equals(DefaultTemplate, other.DefaultTemplate));
 }