コード例 #1
0
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Parser = new CommonInfoParser(Configuration);
     ContentType = new MediaType();
     Info = ContentType.Info;
 }
コード例 #2
0
 public void SetUp()
 {
     Generator = new StructureGenerator(Configuration);
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Candidate = Type = new CodeTypeDeclaration();
     ContentType = new MediaType();
 }
コード例 #3
0
 public void SetUp()
 {
     Generator = new StructureGenerator(Configuration);
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     attribute = new CodeAttributeDeclaration("MediaType");
     contentType = new MediaType();
 }
コード例 #4
0
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Generator = new CommonInfoGenerator(Configuration);
     ContentType = new MediaType { Info = { Alias = "anEntity" } };
     Candidate = Type = new CodeTypeDeclaration();
     info = ContentType.Info;
 }
コード例 #5
0
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Configuration.Namespace = "MyWeb.Models";
     ContentType = new MediaType();
     Generator = new NamespaceGenerator(Configuration);
     compileUnit = new CodeCompileUnit();
 }
コード例 #6
0
 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());
 }
コード例 #7
0
 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");
 }
コード例 #8
0
 public void SetUp()
 {
     contentType = new MediaType
     {
         GenericProperties = new List<GenericProperty>
         {
             new GenericProperty{Alias="prop1"},
             new GenericProperty{Alias="prop2"}
         }
     };
     type = new CodeTypeDeclaration();
 }
コード例 #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
 }
コード例 #10
0
        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)
            );
        }
コード例 #11
0
 private void SetupProperty()
 {
     ContentType = new MediaType();
     Generator = new AttributeCodeGenerator("GenericProperty", Configuration);
     Candidate = new CodeMemberProperty();
 }
コード例 #12
0
 private void SetupMediaType()
 {
     ContentType = new MediaType();
     Generator = new AttributeCodeGenerator("MediaType", Configuration);
     Candidate = new CodeTypeDeclaration();
 }
コード例 #13
0
 public void SetUp()
 {
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Parser = new StructureParser(Configuration);
     ContentType = new MediaType();
 }