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])); } } }
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])); } } }
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)); }
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)); }