Exemplo n.º 1
0
 public static IEnumerable <object[]> Get()
 {
     return(new List <object[]> {
         new object[] { DotNetType.Boolean(), "System.Boolean", },
         new object[] { DotNetType.Byte(), "System.Byte" },
         new object[] { DotNetType.ByteArray(), "System.Byte[]" },
         new object[] { DotNetType.Char(), "System.Char", },
         new object[] { DotNetType.DateTime(), "System.DateTime", },
         new object[] { DotNetType.DateTimeOffset(), "System.DateTimeOffset", },
         new object[] { DotNetType.Decimal(), "System.Decimal", },
         new object[] { DotNetType.Double(), "System.Double", },
         new object[] { DotNetType.Guid(), "System.Guid", },
         new object[] { DotNetType.IDbConnection(), typeof(System.Data.IDbConnection).FullName, },
         new object[] { DotNetType.Integer(), "System.Int32", },
         new object[] { DotNetType.Long(), "System.Int64", },
         new object[] { DotNetType.Short(), "System.Int16", },
         new object[] { DotNetType.Single(), "System.Single", },
         new object[] { DotNetType.String(), "System.String", },
         new object[] { DotNetType.TimeSpan(), "System.TimeSpan", },
         new object[] { DotNetType.Void(), "void", },
         new object[] { DotNetType.MakeIEnumerable(DotNetType.String()), "System.Collections.Generic.IEnumerable<System.String>" },
         new object[] { new DotNetType("System.Int32", true, false, null), "System.Int32[]" },
         new object[] { DotNetType.MakeNullable(DotNetType.Integer()), "System.Nullable<System.Int32>" },
     });
 }
Exemplo n.º 2
0
        public static IEnumerable <object[]> GetTestCases()
        {
            Parameter[] parameters = new Parameter[] {
                new Parameter {
                    Name = "a",
                    Type = DotNetType.Integer(),
                },
                new Parameter {
                    Name = "b",
                    Type = DotNetType.String(),
                },
            };
            return(new List <object[]> {
                new object[] { new Constructor {
                                   AccessModifier = AccessModifier.Public,
                                   Name = "Test",
                                   Body = new CodeBlock("int i = 100;"),
                               }, NormalConstructor.RemoveCarriageReturn(), },

                new object[] { new Constructor {
                                   AccessModifier = AccessModifier.Public,
                                   Name = "Test",
                                   Parameters = parameters,
                               }, ParameterizedConstructor.RemoveCarriageReturn(), },
                new object[] { new Constructor {
                                   Static = true,
                                   Name = "Test",
                                   Body = new CodeBlock("int i = 100;"),
                               }, StaticConstructor.RemoveCarriageReturn(), },
                new object[] { new Constructor {
                                   AccessModifier = AccessModifier.Public,
                                   Name = "Test",
                                   Parameters = parameters,
                                   Body = new CodeBlock("int i = 100;"),
                                   BaseConstructor = new Constructor {
                                       Name = "base",
                                       Parameters = parameters,
                                   }
                               }, BaseConstructor.RemoveCarriageReturn(), },
                new object[] { new Constructor {
                                   AccessModifier = AccessModifier.Public,
                                   Name = "Test",
                                   Parameters = parameters,
                                   Body = new CodeBlock("int i = 100;"),
                                   BaseConstructor = new Constructor {
                                       Name = "this",
                                       Parameters = parameters,
                                   }
                               }, ChainConstructor.RemoveCarriageReturn(), },
            });
        }
Exemplo n.º 3
0
 public static IEnumerable <object[]> GetTestCases()
 {
     return(new List <object[]> {
         new object[] { new Field {
                            Modifier = AccessModifier.Public,
                            Name = "Test",
                            Type = DotNetType.Integer(),
                        }, NormalMethod.RemoveCarriageReturn(), },
         new object[] { new Field {
                            Modifier = AccessModifier.Public,
                            Name = "a",
                            Static = true,
                            Type = DotNetType.String(),
                        }, StaticMethod.RemoveCarriageReturn(), },
     });
 }
Exemplo n.º 4
0
 public static IEnumerable <object[]> GetTestCases()
 {
     return(new List <object[]> {
         new object[] { new Method {
                            AccessModifier = AccessModifier.Public,
                            Name = "Test",
                            Body = new CodeBlock("int i = 100;"),
                            Override = false,
                            ReturnType = DotNetType.Integer(),
                        }, NormalMethod.RemoveCarriageReturn(), },
         new object[] { new Method {
                            AccessModifier = AccessModifier.Public,
                            Name = "Test",
                            Override = false,
                            ReturnType = DotNetType.Integer(),
                            Parameters = new Parameter[] {
                                new Parameter {
                                    Name = "a",
                                    Type = DotNetType.Integer(),
                                },
                                new Parameter {
                                    Name = "b",
                                    Type = DotNetType.String(),
                                },
                            },
                        }, ParameterizedMethod.RemoveCarriageReturn(), },
         new object[] { new Method {
                            AccessModifier = AccessModifier.Public,
                            Name = "Test",
                            Static = true,
                            ReturnType = DotNetType.Void(),
                        }, StaticMethod.RemoveCarriageReturn(), },
         new object[] { new Method {
                            AccessModifier = AccessModifier.Public,
                            Name = "Test",
                            Override = true,
                            ReturnType = DotNetType.Void(),
                        }, OverrideMethod.RemoveCarriageReturn(), },
         new object[] { new Method {
                            AccessModifier = AccessModifier.Public,
                            Name = "Test",
                            Virtual = true,
                            ReturnType = DotNetType.Void(),
                        }, VirtualMethod.RemoveCarriageReturn(), },
     });
 }
Exemplo n.º 5
0
 public static IEnumerable <TestCaseData> GetTestCases()
 {
     return(new TestCaseData[] {
         new TestCaseData(new Field {
             Modifier = AccessModifier.Public,
             Name = "Test",
             Type = DotNetType.Integer(),
         })
         {
             ExpectedResult = NormalMethod.RemoveCarriageReturn(),
         },
         new TestCaseData(new Field {
             Modifier = AccessModifier.Public,
             Name = "a",
             Static = true,
             Type = DotNetType.String(),
         })
         {
             ExpectedResult = StaticMethod.RemoveCarriageReturn(),
         },
     });
 }
Exemplo n.º 6
0
        public static IEnumerable <TestCaseData> GetTestData()
        {
            Type type = typeof(TestClass);

            return(new TestCaseData[] {
                new TestCaseData(type.GetProperty(nameof(TestClass.Text)), new Property(nameof(TestClass.Text))
                {
                    Type = DotNetType.String(), CanWrite = true, CanRead = true,
                }),
                new TestCaseData(type.GetProperty(nameof(TestClass.ReadOnlyText)), new Property(nameof(TestClass.ReadOnlyText))
                {
                    Type = DotNetType.String(), CanWrite = false, CanRead = true,
                }),
                new TestCaseData(type.GetProperty(nameof(TestClass.Number)), new Property(nameof(TestClass.Number))
                {
                    Type = DotNetType.Integer(), CanWrite = true, CanRead = true, Static = true,
                }),
                new TestCaseData(type.GetProperty(nameof(TestClass.Double)), new Property(nameof(TestClass.Double))
                {
                    Type = DotNetType.Double(), CanWrite = true, CanRead = true, SetModifier = AccessModifier.Private,
                }),
            });
        }
Exemplo n.º 7
0
 public static IEnumerable <TestCaseData> GetTestCases()
 {
     Parameter[] parameters = new Parameter[] {
         new Parameter {
             Name = "a",
             Type = DotNetType.Integer(),
         },
         new Parameter {
             Name = "b",
             Type = DotNetType.String(),
         },
     };
     return(new TestCaseData[] {
         new TestCaseData(new Constructor {
             AccessModifier = AccessModifier.Public,
             Name = "Test",
             Body = new CodeBlock("int i = 100;"),
         })
         {
             ExpectedResult = NormalConstructor.RemoveCarriageReturn(),
         },
         new TestCaseData(new Constructor {
             AccessModifier = AccessModifier.Public,
             Name = "Test",
             Parameters = parameters,
         })
         {
             ExpectedResult = ParameterizedConstructor.RemoveCarriageReturn(),
         },
         new TestCaseData(new Constructor {
             Static = true,
             Name = "Test",
             Body = new CodeBlock("int i = 100;"),
         })
         {
             ExpectedResult = StaticConstructor.RemoveCarriageReturn(),
         },
         new TestCaseData(new Constructor {
             AccessModifier = AccessModifier.Public,
             Name = "Test",
             Parameters = parameters,
             Body = new CodeBlock("int i = 100;"),
             BaseConstructor = new Constructor {
                 Name = "base",
                 Parameters = parameters,
             }
         })
         {
             ExpectedResult = BaseConstructor.RemoveCarriageReturn(),
         },
         new TestCaseData(new Constructor {
             AccessModifier = AccessModifier.Public,
             Name = "Test",
             Parameters = parameters,
             Body = new CodeBlock("int i = 100;"),
             BaseConstructor = new Constructor {
                 Name = "this",
                 Parameters = parameters,
             }
         })
         {
             ExpectedResult = ChainConstructor.RemoveCarriageReturn(),
         },
     });
 }
Exemplo n.º 8
0
 static IEnumerable <TestCaseData> Get()
 {
     return(new TestCaseData[] {
         new TestCaseData(DotNetType.Boolean())
         {
             ExpectedResult = "System.Boolean",
         },
         new TestCaseData(DotNetType.Byte())
         {
             ExpectedResult = "System.Byte"
         },
         new TestCaseData(DotNetType.ByteArray())
         {
             ExpectedResult = "System.Byte[]"
         },
         new TestCaseData(DotNetType.Char())
         {
             ExpectedResult = "System.Char",
         },
         new TestCaseData(DotNetType.DateTime())
         {
             ExpectedResult = "System.DateTime",
         },
         new TestCaseData(DotNetType.DateTimeOffset())
         {
             ExpectedResult = "System.DateTimeOffset",
         },
         new TestCaseData(DotNetType.Decimal())
         {
             ExpectedResult = "System.Decimal",
         },
         new TestCaseData(DotNetType.Double())
         {
             ExpectedResult = "System.Double",
         },
         new TestCaseData(DotNetType.Guid())
         {
             ExpectedResult = "System.Guid",
         },
         new TestCaseData(DotNetType.IDbConnection())
         {
             ExpectedResult = typeof(System.Data.IDbConnection).FullName,
         },
         new TestCaseData(DotNetType.Integer())
         {
             ExpectedResult = "System.Int32",
         },
         new TestCaseData(DotNetType.Long())
         {
             ExpectedResult = "System.Int64",
         },
         new TestCaseData(DotNetType.Short())
         {
             ExpectedResult = "System.Int16",
         },
         new TestCaseData(DotNetType.Single())
         {
             ExpectedResult = "System.Single",
         },
         new TestCaseData(DotNetType.String())
         {
             ExpectedResult = "System.String",
         },
         new TestCaseData(DotNetType.TimeSpan())
         {
             ExpectedResult = "System.TimeSpan",
         },
         new TestCaseData(DotNetType.Void())
         {
             ExpectedResult = "void",
         },
         new TestCaseData(DotNetType.MakeIEnumerable(DotNetType.String()))
         {
             ExpectedResult = "System.Collections.Generic.IEnumerable<System.String>"
         },
         new TestCaseData(new DotNetType("System.Int32", true, false, null))
         {
             ExpectedResult = "System.Int32[]"
         },
         new TestCaseData(DotNetType.MakeNullable(DotNetType.Integer()))
         {
             ExpectedResult = "System.Nullable<System.Int32>"
         },
     });
 }