using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using Ringtoets.Piping.IO.SoilProfile;
namespace Ringtoets.Piping.IO.Test.TestHelpers
{
///
/// This class helps to create parameters for testing the .
///
public static class StringGeometryHelper
{
///
/// Takes a which describes a XML document and returns
/// an from this.
///
/// The to convert to an .
/// The constructed from .
/// Thrown when is null.
/// Thrown when does not describe
/// a valid XML document.
public static XDocument GetXmlDocument(string str)
{
return XDocument.Load(new MemoryStream(GetByteArray(str)));
}
///
/// Takes a and returns an of ,
/// which contains the same information as the original .
///
/// The to convert to an of
/// .
/// The of constructed from
/// .
public static byte[] GetByteArray(string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}
}
}