Skip to content

Commit

Permalink
Have TestWithRobot accept args to be formatted into the xml
Browse files Browse the repository at this point in the history
References #8
  • Loading branch information
andreashuber-lawo committed Jan 8, 2016
1 parent 465e1c7 commit 26ee5ca
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Lawo.EmberPlusSharpTest/S101/CommunicationTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,16 +74,18 @@ protected static Task TestWithRobot<TResourceNamespace>(
IS101Logger providerLogger,
EmberTypeBag types,
bool sendFirstMessage,
string logXmlName)
string logXmlName,
params object[] args)
{
var xml = string.Format(CultureInfo.InvariantCulture, GetContent<TResourceNamespace>(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)
{
Expand Down

0 comments on commit 26ee5ca

Please sign in to comment.