From 26ee5ca12b22d01167dc054e80739c432cf72a34 Mon Sep 17 00:00:00 2001 From: andreashuber-lawo Date: Fri, 8 Jan 2016 15:56:47 +0100 Subject: [PATCH] Have TestWithRobot accept args to be formatted into the xml References #8 --- .../S101/CommunicationTestBase.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Lawo.EmberPlusSharpTest/S101/CommunicationTestBase.cs b/Lawo.EmberPlusSharpTest/S101/CommunicationTestBase.cs index 98b56e18..fb115d49 100644 --- a/Lawo.EmberPlusSharpTest/S101/CommunicationTestBase.cs +++ b/Lawo.EmberPlusSharpTest/S101/CommunicationTestBase.cs @@ -8,6 +8,7 @@ namespace Lawo.EmberPlusSharp.S101 { using System; using System.Diagnostics.CodeAnalysis; + using System.Globalization; using System.IO; using System.Linq; using System.Net; @@ -73,16 +74,18 @@ protected static Task TestWithRobot( IS101Logger providerLogger, EmberTypeBag types, bool sendFirstMessage, - string logXmlName) + string logXmlName, + params object[] args) { + var xml = string.Format(CultureInfo.InvariantCulture, GetContent(logXmlName), args); + return TestNoExceptionsAsync( async (consumerClientTask, providerClient) => { - using (var resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream( - typeof(TResourceNamespace), logXmlName)) - using (var reader = XmlReader.Create(resourceStream)) + using (var reader = new StringReader(xml)) + using (var xmlReader = XmlReader.Create(reader)) { - var robotTask = S101Robot.RunAsync(providerClient, types, reader, sendFirstMessage); + var robotTask = S101Robot.RunAsync(providerClient, types, xmlReader, sendFirstMessage); using (var consumerClient = await consumerClientTask) {