public static String Write(SourceCodeLanguage language, InterfaceProperty property)
        {
            var sc = Create(language);

            sc.Write(property);
            return(sc.TextWriter.ToString());
        }
        public void InterfacePropertyGetFeature()
        {
            var p = new InterfaceProperty(new TypeName("String"), "DisplayName", true, false);

            Assert.AreEqual("String DisplayName { get; }" + SourceCodeGenerator.NewLine
                , SourceCodeGenerator.Write(SourceCodeLanguage.CSharp, p));
        }
Exemple #3
0
        public void InterfaceBasicFeature()
        {
            var c = new Interface("IPerson");

            var p = new InterfaceProperty("Int32", "Age", true, true);
            c.Properties.Add(p);

            var md = new InterfaceMethod("GetNumber");
            c.Methods.Add(md);

            Assert.AreEqual("public interface IPerson" + SourceCodeGenerator.NewLine
                + "{" + SourceCodeGenerator.NewLine
                + "    Int32 Age { get; set; }" + SourceCodeGenerator.NewLine
                + SourceCodeGenerator.NewLine
                + "    void GetNumber();" + SourceCodeGenerator.NewLine
                + "}" + SourceCodeGenerator.NewLine
                , SourceCodeGenerator.Write(SourceCodeLanguage.CSharp, c));
        }
        public override void Write(InterfaceProperty property)
        {
            var writer = this.TextWriter;

            this.WriteIndent();
            this.Write(property.TypeName);
            writer.Write(" ");
            writer.Write(property.Name);
            writer.Write(" { ");
            if (property.Get == true)
            {
                writer.Write("get; ");
            }
            if (property.Set == true)
            {
                writer.Write("set; ");
            }
            writer.Write("}");
            writer.WriteLine();
        }
 public override void Write(InterfaceProperty property)
 {
     throw new NotImplementedException();
 }
 public abstract void Write(InterfaceProperty property);
 public override void Write(InterfaceProperty property)
 {
     throw new NotImplementedException();
 }
 public abstract void Write(InterfaceProperty property);
 public static String Write(SourceCodeLanguage language, InterfaceProperty property)
 {
     var sc = Create(language);
     sc.Write(property);
     return sc.TextWriter.ToString();
 }