示例#1
0
 public FakeMethod(string name, FakeType returnType, FakeParameter[] parameters, FakeAttribute[] attributes = null)
 {
     Name       = name;
     ReturnType = returnType;
     Parameters = parameters;
     Attributes = attributes;
 }
示例#2
0
        public FakeProperty(string name, FakeType propertyType, PropertyMethods propertyMethods, FakeAttribute[] attributes = null)
        {
            Name         = name;
            PropertyType = propertyType;
            Attributes   = attributes;

            switch (propertyMethods)
            {
            case PropertyMethods.HasGetOnly:
                GetMethod = new FakeMethod($"get_{name}", propertyType, null);
                break;

            case PropertyMethods.HasSetOnly:
                SetMethod = new FakeMethod($"set_{name}", null, new[] { new FakeParameter("value", propertyType) });
                break;

            case PropertyMethods.HasGetAndSet:
                GetMethod = new FakeMethod($"get_{name}", propertyType, null);
                SetMethod = new FakeMethod($"set_{name}", null, new[] { new FakeParameter("value", propertyType) });
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(propertyMethods), propertyMethods, null);
            }
        }
 public FakeParameter(string name, FakeType parameterType)
 {
     Name          = name;
     ParameterType = parameterType;
 }
示例#4
0
 public FakeField(string name, FakeType fieldType, FakeAttribute[] attributes = null)
 {
     Name       = name;
     FieldType  = fieldType;
     Attributes = attributes;
 }