예제 #1
0
        public GrassCommand(string filePath)
        {
            var lines = File.ReadAllLines(filePath);

            Name        = lines[0];
            Description = lines[1];
            Group       = lines[2];
            Parameters  = new List <IParameter>();
            for (int i = 3; i < lines.Length; i++)
            {
                if (string.IsNullOrEmpty(lines[i]))
                {
                    Console.WriteLine(lines[i]);
                }
                else
                {
                    Parameters.Add(ParameterFactory.CreateParameter(lines[i]));
                }
            }
        }
예제 #2
0
        public GrassCommand()
        {
            string filePath = @"C:\Users\Administrator\Desktop\description\i.albedo.txt";
            var    lines    = File.ReadAllLines(filePath);

            Name        = lines[0];
            Description = lines[1];
            Group       = lines[2];
            Parameters  = new List <IParameter>();
            for (int i = 3; i < lines.Length; i++)
            {
                if (string.IsNullOrEmpty(lines[i]))
                {
                    Console.WriteLine(lines[i]);
                }
                else
                {
                    Parameters.Add(ParameterFactory.CreateParameter(lines[i]));
                }
            }
        }
예제 #3
0
        public void CreateParameter_ReturnsWith_DataType_IsOptional_ParamName_ParamType()
        {
            // Arrange
            Setup();
            var paramSource = ApiParameterSource.FromUri;
            var dataType    = typeof(BlogPost);
            var isOptional  = true;
            var paramName   = "param3";

            var input = TestHelper.CreateParameter(paramName, dataType, isOptional, paramSource);


            // Act
            dynamic rtnParam = _factory.CreateParameter(input, "");


            // Assert
            Assert.AreEqual(dataType.Name, rtnParam.dataType, "param source (body, uri, unknown");
            Assert.AreEqual(!isOptional, rtnParam.required, "is required");
            Assert.AreEqual(paramName, rtnParam.name, "param name");
            Assert.AreEqual(ParamType.query.ToString(), rtnParam.paramType, "param Type");
            Debug.WriteLine(JsonConvert.SerializeObject((object)rtnParam));
        }
예제 #4
0
 public IDbDataParameter CreateParameter(string providerName, string name, object value, DbType dbType, int size = 0, ParameterDirection direction = ParameterDirection.Input)
 {
     return(ParameterFactory.CreateParameter(providerName, name, value, dbType, size, direction));
 }