예제 #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();
        }
예제 #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();
        }
예제 #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();
        }
예제 #4
0
 public InterfaceBuilder AddMethod(InterfaceMethodBuilder method)
 {
     _methods.Add(method);
     return(this);
 }