public void SqlParameterTest() { // Arrange var helper = new ProcedureHelper(); var procedure = new Procedure("proc", "proc", null, new List <Parameter> { new Parameter("param1", DataTypeHelper.Instance.GetMap(TypeFormat.DotNetFrameworkType, "Int32?"), false, null), new Parameter("param2", DataTypeHelper.Instance.GetMap(TypeFormat.DotNetFrameworkType, "Int32?"), true, null) }, null); // Act var result = helper.GetSqlParamList(procedure); // Assert Assert.AreEqual(@"cmd.Parameters.Add(""param1"", SqlDbType.Int).Value = (object)param1 ?? DBNull.Value; var param2OutputParameter = new SqlParameter(""param2"", SqlDbType.Int) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(param2OutputParameter); ", result); }
public void SqlParameterTest() { // Arrange var helper = new ProcedureHelper(); var procedure = new Procedure("proc", "proc", null, new List<Parameter> { new Parameter("param1", DataTypeHelper.Instance.GetMap(TypeFormat.DotNetFrameworkType, "Int32?"), false, null), new Parameter("param2", DataTypeHelper.Instance.GetMap(TypeFormat.DotNetFrameworkType, "Int32?"), true, null) }, null); // Act var result = helper.GetSqlParamList(procedure); // Assert Assert.AreEqual(@"cmd.Parameters.Add(""param1"", SqlDbType.Int).Value = (object)param1 ?? DBNull.Value; var param2OutputParameter = new SqlParameter(""param2"", SqlDbType.Int) { Direction = ParameterDirection.Output }; cmd.Parameters.Add(param2OutputParameter); ", result); }