public async Task ExecuteXmlReader_WithNoParameters_ExecuteReturnsExpectedString() { SqlProgram program = await SqlProgram.Create((Connection)DifferentLocalDatabaseConnectionString, name : "spReturnsXml"); XElement result = program.ExecuteXmlReader(XElement.Load); Assert.AreEqual("<foo>bar</foo>", result.ToString()); }
public async Task ExecuteXmlReader_WithParameters_ReturnedExpectedXml() { SqlProgram <XElement> program = await SqlProgram <XElement> .Create( (Connection)DifferentLocalDatabaseConnectionString, name : "spTakesXml"); XElement element = XElement.Parse("<foo>bar</foo>"); XElement result = program.ExecuteXmlReader(XElement.Load, element); Assert.AreEqual(element.ToString(), result.ToString()); }
public async Task ExecuteXmlReader_WithOutputParameters_ExecutesSuccessfully() { SqlProgram <int, Out <int>, Out <int> > program = await SqlProgram <int, Out <int>, Out <int> > .Create((Connection)LocalDatabaseConnectionString, "spOutputParameters"); const int inputVal = 123; const int inputOutputVal = 321; Out <int> inputOutput = new Out <int>(inputOutputVal); Out <int> output = new Out <int>(); XElement result = program.ExecuteXmlReader(XElement.Load, inputVal, inputOutput, output); Assert.AreEqual("<foo>bar</foo>", result.ToString()); Assert.IsNull(inputOutput.OutputError, inputOutput.OutputError?.Message); Assert.IsNull(output.OutputError, output.OutputError?.Message); Assert.AreEqual(inputOutputVal * 2, inputOutput.OutputValue.Value); Assert.AreEqual(inputVal, output.OutputValue.Value); }