public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Parser = new CommonInfoParser(Configuration);
     ContentType = new MediaType();
     Info = ContentType.Info;
 }
 public void SetUp()
 {
     Generator = new StructureGenerator(Configuration);
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Candidate = Type = new CodeTypeDeclaration();
     ContentType = new MediaType();
 }
 public void SetUp()
 {
     Generator = new StructureGenerator(Configuration);
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     attribute = new CodeAttributeDeclaration("MediaType");
     contentType = new MediaType();
 }
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Generator = new CommonInfoGenerator(Configuration);
     ContentType = new MediaType { Info = { Alias = "anEntity" } };
     Candidate = Type = new CodeTypeDeclaration();
     info = ContentType.Info;
 }
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Configuration.Namespace = "MyWeb.Models";
     ContentType = new MediaType();
     Generator = new NamespaceGenerator(Configuration);
     compileUnit = new CodeCompileUnit();
 }
 protected void ParseProperty(string code)
 {
     const string propertyName = "AProperty";
     ContentType = new MediaType();
     var type = ParseType(code);
     var prop = type.Members.SingleOrDefault(m => m.Name == propertyName);
     Parser.Parse(prop, ContentType);
     Property = ContentType.GenericProperties.SingleOrDefault(p => p.Alias == propertyName.CamelCase());
 }
 public void SetUp()
 {
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Generator = new ClassGenerator(
         Configuration,
         new EntityDescriptionGenerator(Configuration)
         );
     ContentType = new MediaType { Info = { Alias = "anEntity" } };
     EntityDescription = info = ContentType.Info;
     ns = new CodeNamespace("ANamespace");
 }
 public void SetUp()
 {
     contentType = new MediaType
     {
         GenericProperties = new List<GenericProperty>
         {
             new GenericProperty{Alias="prop1"},
             new GenericProperty{Alias="prop2"}
         }
     };
     type = new CodeTypeDeclaration();
 }
Exemplo n.º 9
0
 public void Parse_AddsTabForEachDistinctNonEmptyPropertyTab()
 {
     var contentType = new MediaType
     {
         GenericProperties = new List<GenericProperty>
         {
             new GenericProperty {Tab = "A"},
             new GenericProperty {Tab = "A"},
             new GenericProperty {Tab = "B"},
             new GenericProperty {Tab = ""},
             new GenericProperty()
         }
     };
     var parser = new TabsParser(null);
     parser.Parse(null, contentType);
     Assert.That(
         new[]{"A","B"}
         .SequenceEqual(contentType.Tabs.Select(t => t.Caption))
         );
     Assert.AreEqual(0, contentType.Tabs.Sum(t => t.Id));
     // TODO: Tab sortorder
 }
        public void RunsPropertyParserForEachProperty()
        {
            const string code = @"
                public class AClass {
                    public string One {get;set;}
                    public string Two {get;set;}
                }";

            var tree = ParseType(code);
            var contentType = new MediaType();
            var propertyParser = new SpyPropertyParser(null);
            var parser = new PropertiesParser(
                new ContentTypeConfiguration(), 
                propertyParser
            );

            parser.Parse(tree, contentType);
            Assert.IsTrue(
                new[]{"One", "Two"}
                .SequenceEqual(propertyParser.PropertyNames)
            );
        }
 private void SetupProperty()
 {
     ContentType = new MediaType();
     Generator = new AttributeCodeGenerator("GenericProperty", Configuration);
     Candidate = new CodeMemberProperty();
 }
 private void SetupMediaType()
 {
     ContentType = new MediaType();
     Generator = new AttributeCodeGenerator("MediaType", Configuration);
     Candidate = new CodeTypeDeclaration();
 }
Exemplo n.º 13
0
 public void SetUp()
 {
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Parser = new StructureParser(Configuration);
     ContentType = new MediaType();
 }