Ejemplo n.º 1
0
        public async Task CreateMethod()
        {
            // arrange
            var sb     = new StringBuilder();
            var writer = new CodeWriter(sb);

            // act
            await InterfaceMethodBuilder.New()
            .SetName("GetAbc")
            .BuildAsync(writer);

            // assert
            sb.ToString().MatchSnapshot();
        }
Ejemplo n.º 2
0
        public async Task CreateMethod_With_One_Parameter()
        {
            // arrange
            var sb     = new StringBuilder();
            var writer = new CodeWriter(sb);

            // act
            await InterfaceMethodBuilder.New()
            .SetName("GetAbc")
            .AddParameter(ParameterBuilder.New().SetName("abc").SetType("String"))
            .BuildAsync(writer);

            // assert
            sb.ToString().MatchSnapshot();
        }
Ejemplo n.º 3
0
        public async Task Create_Interface_With_Property_Method()
        {
            // arrange
            var sb     = new StringBuilder();
            var writer = new CodeWriter(sb);

            // act
            await InterfaceBuilder.New()
            .SetName("IMarker")
            .AddProperty(InterfacePropertyBuilder.New()
                         .SetName("Property1")
                         .SetType("Bar"))
            .AddMethod(InterfaceMethodBuilder.New()
                       .SetName("Method1")
                       .SetReturnType("Bar"))
            .BuildAsync(writer);

            // assert
            sb.ToString().MatchSnapshot();
        }
Ejemplo n.º 4
0
 public InterfaceBuilder AddMethod(InterfaceMethodBuilder method)
 {
     _methods.Add(method);
     return(this);
 }