From c6012164a6e1f5562267bafa0ca3083163d877ae Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Thu, 2 Feb 2023 00:49:42 -0500 Subject: [PATCH 1/3] Use XmlWriter instead of XDocument to reduce memory and increase performance --- src/Twilio/TwiML/Fax/Receive.cs | 2 +- src/Twilio/TwiML/Messaging/Message.cs | 2 +- src/Twilio/TwiML/Messaging/Redirect.cs | 2 +- src/Twilio/TwiML/Text.cs | 22 +- src/Twilio/TwiML/TwiML.cs | 110 +----- src/Twilio/TwiML/TwiMLSerializer.cs | 332 ++++++++++++++++++ src/Twilio/TwiML/Voice/Application.cs | 2 +- src/Twilio/TwiML/Voice/Client.cs | 2 +- src/Twilio/TwiML/Voice/Conference.cs | 2 +- src/Twilio/TwiML/Voice/Config.cs | 2 +- src/Twilio/TwiML/Voice/Connect.cs | 2 +- src/Twilio/TwiML/Voice/Conversation.cs | 2 +- src/Twilio/TwiML/Voice/Dial.cs | 2 +- src/Twilio/TwiML/Voice/Enqueue.cs | 2 +- src/Twilio/TwiML/Voice/Gather.cs | 2 +- src/Twilio/TwiML/Voice/Number.cs | 2 +- src/Twilio/TwiML/Voice/Parameter.cs | 2 +- src/Twilio/TwiML/Voice/Pause.cs | 2 +- src/Twilio/TwiML/Voice/Pay.cs | 2 +- src/Twilio/TwiML/Voice/Play.cs | 2 +- src/Twilio/TwiML/Voice/Prompt.cs | 2 +- src/Twilio/TwiML/Voice/Queue.cs | 2 +- src/Twilio/TwiML/Voice/Record.cs | 2 +- src/Twilio/TwiML/Voice/Redirect.cs | 2 +- src/Twilio/TwiML/Voice/Refer.cs | 2 +- src/Twilio/TwiML/Voice/Reject.cs | 2 +- src/Twilio/TwiML/Voice/Room.cs | 2 +- src/Twilio/TwiML/Voice/Say.cs | 2 +- src/Twilio/TwiML/Voice/Sip.cs | 2 +- src/Twilio/TwiML/Voice/Siprec.cs | 2 +- src/Twilio/TwiML/Voice/Sms.cs | 2 +- src/Twilio/TwiML/Voice/SsmlBreak.cs | 2 +- src/Twilio/TwiML/Voice/SsmlEmphasis.cs | 2 +- src/Twilio/TwiML/Voice/SsmlLang.cs | 2 +- src/Twilio/TwiML/Voice/SsmlPhoneme.cs | 2 +- src/Twilio/TwiML/Voice/SsmlProsody.cs | 2 +- src/Twilio/TwiML/Voice/SsmlSayAs.cs | 2 +- src/Twilio/TwiML/Voice/SsmlSub.cs | 2 +- src/Twilio/TwiML/Voice/SsmlW.cs | 2 +- src/Twilio/TwiML/Voice/Start.cs | 2 +- src/Twilio/TwiML/Voice/Stream.cs | 2 +- src/Twilio/TwiML/Voice/Task.cs | 2 +- src/Twilio/TwiML/Voice/VirtualAgent.cs | 2 +- src/Twilio/Twilio.csproj | 11 +- test/Twilio.Test/TwiML/ApplicationSidTest.cs | 4 +- test/Twilio.Test/TwiML/ApplicationTest.cs | 6 +- test/Twilio.Test/TwiML/AutopilotTest.cs | 4 +- test/Twilio.Test/TwiML/BodyTest.cs | 6 +- test/Twilio.Test/TwiML/ClientTest.cs | 6 +- test/Twilio.Test/TwiML/ConferenceTest.cs | 4 +- test/Twilio.Test/TwiML/ConfigTest.cs | 6 +- test/Twilio.Test/TwiML/ConnectTest.cs | 12 +- test/Twilio.Test/TwiML/ConversationTest.cs | 6 +- test/Twilio.Test/TwiML/DialTest.cs | 6 +- test/Twilio.Test/TwiML/EchoTest.cs | 4 +- test/Twilio.Test/TwiML/EnqueueTest.cs | 4 +- test/Twilio.Test/TwiML/FaxResponseTest.cs | 6 +- test/Twilio.Test/TwiML/GatherTest.cs | 10 +- test/Twilio.Test/TwiML/HangupTest.cs | 6 +- test/Twilio.Test/TwiML/IdentityTest.cs | 4 +- test/Twilio.Test/TwiML/LeaveTest.cs | 4 +- test/Twilio.Test/TwiML/MediaTest.cs | 4 +- test/Twilio.Test/TwiML/MessageTest.cs | 4 +- .../TwiML/MessagingResponseTest.cs | 6 +- test/Twilio.Test/TwiML/NumberTest.cs | 4 +- test/Twilio.Test/TwiML/ParameterTest.cs | 6 +- test/Twilio.Test/TwiML/PauseTest.cs | 6 +- test/Twilio.Test/TwiML/PayTest.cs | 12 +- test/Twilio.Test/TwiML/PlayTest.cs | 4 +- test/Twilio.Test/TwiML/PromptTest.cs | 10 +- test/Twilio.Test/TwiML/QueueTest.cs | 4 +- test/Twilio.Test/TwiML/ReceiveTest.cs | 6 +- test/Twilio.Test/TwiML/RecordTest.cs | 6 +- test/Twilio.Test/TwiML/RedirectTest.cs | 4 +- test/Twilio.Test/TwiML/ReferSipTest.cs | 4 +- test/Twilio.Test/TwiML/ReferTest.cs | 6 +- test/Twilio.Test/TwiML/RejectTest.cs | 8 +- test/Twilio.Test/TwiML/RoomTest.cs | 4 +- test/Twilio.Test/TwiML/SayTest.cs | 6 +- test/Twilio.Test/TwiML/SerializationTest.cs | 256 ++++++++++++++ test/Twilio.Test/TwiML/SimTest.cs | 4 +- test/Twilio.Test/TwiML/SipTest.cs | 4 +- test/Twilio.Test/TwiML/SiprecTest.cs | 8 +- test/Twilio.Test/TwiML/SmsTest.cs | 4 +- test/Twilio.Test/TwiML/SsmlBreakTest.cs | 6 +- test/Twilio.Test/TwiML/SsmlEmphasisTest.cs | 6 +- test/Twilio.Test/TwiML/SsmlLangTest.cs | 6 +- test/Twilio.Test/TwiML/SsmlPTest.cs | 6 +- test/Twilio.Test/TwiML/SsmlPhonemeTest.cs | 4 +- test/Twilio.Test/TwiML/SsmlProsodyTest.cs | 6 +- test/Twilio.Test/TwiML/SsmlSTest.cs | 6 +- test/Twilio.Test/TwiML/SsmlSayAsTest.cs | 4 +- test/Twilio.Test/TwiML/SsmlSubTest.cs | 4 +- test/Twilio.Test/TwiML/SsmlWTest.cs | 6 +- test/Twilio.Test/TwiML/StartTest.cs | 12 +- test/Twilio.Test/TwiML/StopTest.cs | 10 +- test/Twilio.Test/TwiML/StreamTest.cs | 8 +- test/Twilio.Test/TwiML/TaskTest.cs | 4 +- test/Twilio.Test/TwiML/VirtualAgentTest.cs | 10 +- test/Twilio.Test/TwiML/VoiceResponseTest.cs | 32 +- test/Twilio.Test/TwiML/XmlEscapeTest.cs | 36 ++ test/Twilio.Test/Twilio.Test.csproj | 15 +- 102 files changed, 893 insertions(+), 321 deletions(-) create mode 100644 src/Twilio/TwiML/TwiMLSerializer.cs create mode 100644 test/Twilio.Test/TwiML/SerializationTest.cs create mode 100644 test/Twilio.Test/TwiML/XmlEscapeTest.cs diff --git a/src/Twilio/TwiML/Fax/Receive.cs b/src/Twilio/TwiML/Fax/Receive.cs index a30217243..88dee26f9 100644 --- a/src/Twilio/TwiML/Fax/Receive.cs +++ b/src/Twilio/TwiML/Fax/Receive.cs @@ -91,7 +91,7 @@ public Receive(Uri action = null, /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Action != null) diff --git a/src/Twilio/TwiML/Messaging/Message.cs b/src/Twilio/TwiML/Messaging/Message.cs index 85ffda8eb..b0351532d 100644 --- a/src/Twilio/TwiML/Messaging/Message.cs +++ b/src/Twilio/TwiML/Messaging/Message.cs @@ -78,7 +78,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.To != null) diff --git a/src/Twilio/TwiML/Messaging/Redirect.cs b/src/Twilio/TwiML/Messaging/Redirect.cs index 2a7647caf..cdf2071da 100644 --- a/src/Twilio/TwiML/Messaging/Redirect.cs +++ b/src/Twilio/TwiML/Messaging/Redirect.cs @@ -49,7 +49,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Method != null) diff --git a/src/Twilio/TwiML/Text.cs b/src/Twilio/TwiML/Text.cs index 5efb4a6e6..cc6e401b7 100644 --- a/src/Twilio/TwiML/Text.cs +++ b/src/Twilio/TwiML/Text.cs @@ -1,4 +1,9 @@ -using System.Xml.Linq; +#if !NET35 +using System.Threading; +using System.Threading.Tasks; +#endif +using System.Xml; +using System.Xml.Linq; namespace Twilio.TwiML { @@ -15,5 +20,18 @@ protected override XNode ToXml() { return new XText(_content); } + +#if !NET35 + protected override async Task WriteXml(XmlWriter writer, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + await writer.WriteStringAsync(_content).ConfigureAwait(false); + } +#endif + + protected override void WriteContent(XmlWriter writer) + { + writer.WriteString(_content); + } } -} +} \ No newline at end of file diff --git a/src/Twilio/TwiML/TwiML.cs b/src/Twilio/TwiML/TwiML.cs index ec625992d..290c52caf 100644 --- a/src/Twilio/TwiML/TwiML.cs +++ b/src/Twilio/TwiML/TwiML.cs @@ -1,34 +1,28 @@ using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Text; using System.Xml.Linq; -using Twilio.Exceptions; namespace Twilio.TwiML { - /// /// Base class for all TwiML Objects. /// - public class TwiML + public partial class TwiML { /// /// Tag name /// private string TagName { get; } + /// /// Children elements /// private List Children { get; } + /// /// Additional tag attributes to set on the generated xml /// - private List> Options { get; } - /// - /// Attribute names to be transformed on the generated xml - /// - private Dictionary AttributeNameMapper = new Dictionary { { "for_", "for" } }; + private List> Options { get; } /// /// Base constructor to create any TwiML instance. @@ -36,9 +30,9 @@ public class TwiML /// TwiML tag name protected TwiML(string tagName) { - this.TagName = tagName; - this.Children = new List(); - this.Options = new List>(); + TagName = tagName; + Children = new List(); + Options = new List>(); } /// @@ -52,9 +46,9 @@ protected virtual string GetElementBody() /// /// Get the TwiML element attributes. /// - protected virtual List GetElementAttributes() + protected virtual IEnumerable GetElementAttributes() { - return new List(); + return Enumerable.Empty(); } /// @@ -63,13 +57,13 @@ protected virtual List GetElementAttributes() /// Child TwiML element to add public virtual TwiML Append(TwiML childElem) { - this.Children.Add(childElem); + Children.Add(childElem); return this; } public TwiML AddText(string text) { - this.Children.Add(new Text(text)); + Children.Add(new Text(text)); return this; } @@ -79,7 +73,7 @@ public TwiML AddText(string text) /// Child TwiML element to add public T Nest(T childElem) where T : TwiML { - this.Children.Add(childElem); + Children.Add(childElem); return childElem; } @@ -89,7 +83,7 @@ public T Nest(T childElem) where T : TwiML /// TwiML tag name public TwiML AddChild(string tagName) { - return this.Nest(new TwiML(tagName)); + return Nest(new TwiML(tagName)); } /// @@ -99,12 +93,12 @@ public TwiML AddChild(string tagName) /// Option value public TwiML SetOption(string key, object value) { - if (this.Options.Exists(e => e.Key.Equals(key))) + if (Options.Exists(e => e.Key.Equals(key))) { - this.Options.Remove(this.Options.Find(e => e.Key.Equals(key))); + Options.Remove(Options.Find(e => e.Key.Equals(key))); } - this.Options.Add(new KeyValuePair(key, value.ToString())); + Options.Add(new KeyValuePair(key, value.ToString())); return this; } @@ -114,77 +108,7 @@ public TwiML SetOption(string key, object value) /// Option key public virtual string GetOption(string key) { - return this.Options.Find(e => e.Key.Equals(key)).Value; - } - - /// - /// Generate XElement from TwiML object - /// - protected virtual XNode ToXml() - { - var elem = new XElement(this.TagName, this.GetElementBody()); - - this.GetElementAttributes().ForEach(attr => - { - string transformedAttr = attr.Name.LocalName; - if (AttributeNameMapper.TryGetValue(attr.Name.LocalName, out transformedAttr)) - { - elem.Add(new XAttribute(transformedAttr, attr.Value)); - } - else - { - elem.Add(attr); - } - }); - - this.Options.ForEach(e => - { - if (e.Key.StartsWith("xml:")) - { - var attribute = new XAttribute(XNamespace.Xml + e.Key.Substring(4), e.Value); - elem.Add(attribute); - } - else - { - elem.Add(new XAttribute(e.Key, e.Value)); - } - }); - - this.Children.ForEach(child => elem.Add(child.ToXml())); - - return elem; - } - - /// - /// Generate XDocument from TwiML object - /// - public XDocument ToXDocument() - { - var declaration = new XDeclaration("1.0", "utf-8", null); - var elem = this.ToXml(); - var document = new XDocument(declaration, elem); - return document; - } - - /// - /// Generate XML string from TwiML object - /// - /// Change generated string format. - public string ToString(SaveOptions formattingOptions = SaveOptions.None) - { - var document = this.ToXDocument(); - var writer = new Utf8StringWriter(); - document.Save(writer, formattingOptions); - return writer.GetStringBuilder().ToString(); + return Options.Find(e => e.Key.Equals(key)).Value; } } - - /// - /// StringWriter which overrides default encoding to use UTF8. - /// - public class Utf8StringWriter : StringWriter - { - public override Encoding Encoding => Encoding.UTF8; - } - } \ No newline at end of file diff --git a/src/Twilio/TwiML/TwiMLSerializer.cs b/src/Twilio/TwiML/TwiMLSerializer.cs new file mode 100644 index 000000000..37ad002b1 --- /dev/null +++ b/src/Twilio/TwiML/TwiMLSerializer.cs @@ -0,0 +1,332 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading; +using System.Xml; +using System.Xml.Linq; +using Stream = System.IO.Stream; +#if !NET35 +using System.Threading.Tasks; +using Task = System.Threading.Tasks.Task; +#endif + +namespace Twilio.TwiML +{ + /// + /// Base class for all TwiML Objects. + /// + public partial class TwiML + { + /// + /// Attribute names to be transformed on the generated xml + /// + private static Dictionary AttributeNameMapper = new Dictionary {{"for_", "for"}}; + + /// + /// Generate XElement from TwiML object + /// + [Obsolete] + protected virtual XNode ToXml() + { + var elem = new XElement(TagName, GetElementBody()); + + foreach(var attr in GetElementAttributes()) + { + string transformedAttr = attr.Name.LocalName; + if (AttributeNameMapper.TryGetValue(attr.Name.LocalName, out transformedAttr)) + { + elem.Add(new XAttribute(transformedAttr, attr.Value)); + } + else + { + elem.Add(attr); + } + } + + Options.ForEach(e => + { + if (e.Key.StartsWith("xml:")) + { + var attribute = new XAttribute(XNamespace.Xml + e.Key.Substring(4), e.Value); + elem.Add(attribute); + } + else + { + elem.Add(new XAttribute(e.Key, e.Value)); + } + }); + + Children.ForEach(child => elem.Add(child.ToXml())); + + return elem; + } + + /// + /// Generate XDocument from TwiML object + /// + [Obsolete("ToXDocument will be removed in the future. Please use ToString, Save, or SaveAsync.")] + public XDocument ToXDocument() + { + var declaration = new XDeclaration("1.0", "utf-8", null); + var elem = ToXml(); + var document = new XDocument(declaration, elem); + return document; + } + + public void Save(TextWriter textWriter) + { + Save(textWriter, SaveOptions.None); + } + + public void Save(TextWriter textWriter, SaveOptions options) + { + var ws = GetXmlWriterSettings(options); + using (var writer = XmlWriter.Create(textWriter, ws)) + Save(writer, options); + } + + public void Save(Stream stream) + { + Save(stream, SaveOptions.None); + } + + public void Save(Stream stream, SaveOptions options) + { + var ws = GetXmlWriterSettings(options); + using (var writer = XmlWriter.Create(stream, ws)) + Save(writer, options); + } + + public void Save(XmlWriter writer) + { + Save(writer, SaveOptions.None); + } + + public void Save(XmlWriter writer, SaveOptions options) + { + writer.WriteStartDocument(); + WriteContent(writer); + writer.WriteEndDocument(); + writer.Flush(); + } + + protected virtual void WriteContent(XmlWriter writer) + { + writer.WriteStartElement(null, TagName, null); + + foreach (var attribute in GetElementAttributes()) + { + var attributeName = attribute.Name.LocalName; + string mappedName; + if (AttributeNameMapper.TryGetValue(attributeName, out mappedName)) + { + writer.WriteAttributeString( + null, + mappedName, + attribute.Name.NamespaceName, + attribute.Value + ); + } + else + { + writer.WriteAttributeString( + null, + attributeName, + attribute.Name.NamespaceName, + attribute.Value + ); + } + } + + foreach (var option in Options) + { + if (option.Key.StartsWith("xml:")) + { + writer.WriteAttributeString( + null, + option.Key.Substring(4), + XNamespace.Xml.NamespaceName, + option.Value + ); + } + else + { + writer.WriteAttributeString(null, option.Key, null, option.Value); + } + } + + var body = GetElementBody(); + if (!string.IsNullOrEmpty(body)) + { + writer.WriteString(body); + } + else + { + foreach (var child in Children) + { + child.WriteContent(writer); + } + } + + writer.WriteEndElement(); + } + +#if !NET35 + public Task SaveAsync(TextWriter textWriter, CancellationToken cancellationToken) + { + return SaveAsync(textWriter, SaveOptions.None, cancellationToken); + } + + public async Task SaveAsync(TextWriter textWriter, SaveOptions options, CancellationToken cancellationToken) + { + var ws = GetXmlWriterSettings(options); + ws.Async = true; + var writer = XmlWriter.Create(textWriter, ws); +#if NET6_0_OR_GREATER + await using (writer.ConfigureAwait(false)) + { +#else + using (writer) + { +#endif + await SaveAsync(writer, cancellationToken).ConfigureAwait(false); + } + } + + public Task SaveAsync(Stream stream, CancellationToken cancellationToken) + { + return SaveAsync(stream, SaveOptions.None, cancellationToken); + } + + public async Task SaveAsync(Stream stream, SaveOptions options, CancellationToken cancellationToken) + { + var ws = GetXmlWriterSettings(options); + ws.Async = true; + var writer = XmlWriter.Create(stream, ws); +#if NET6_0_OR_GREATER + await using (writer.ConfigureAwait(false)) + { +#else + using (writer) + { +#endif + await SaveAsync(writer, cancellationToken).ConfigureAwait(false); + } + } + + public async Task SaveAsync(XmlWriter writer, CancellationToken cancellationToken) + { + await writer.WriteStartDocumentAsync().ConfigureAwait(false); + await WriteXml(writer, cancellationToken).ConfigureAwait(false); + await writer.WriteEndDocumentAsync().ConfigureAwait(false); + await writer.FlushAsync().ConfigureAwait(false); + } + + protected virtual async Task WriteXml(XmlWriter writer, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + await writer.WriteStartElementAsync(null, TagName, null).ConfigureAwait(false); + + foreach (var attribute in GetElementAttributes()) + { + var attributeName = attribute.Name.LocalName; + string mappedName; + if (AttributeNameMapper.TryGetValue(attributeName, out mappedName)) + { + await writer.WriteAttributeStringAsync( + null, + mappedName, + attribute.Name.NamespaceName, + attribute.Value + ).ConfigureAwait(false); + } + else + { + await writer.WriteAttributeStringAsync( + null, + attributeName, + attribute.Name.NamespaceName, + attribute.Value + ).ConfigureAwait(false); + } + } + + foreach (var option in Options) + { + if (option.Key.StartsWith("xml:")) + { + await writer.WriteAttributeStringAsync( + null, + option.Key.Substring(4), + XNamespace.Xml.NamespaceName, + option.Value + ).ConfigureAwait(false); + } + else + { + await writer.WriteAttributeStringAsync(null, option.Key, null, option.Value) + .ConfigureAwait(false); + } + } + + var body = GetElementBody(); + if (!string.IsNullOrEmpty(body)) + { + await writer.WriteStringAsync(body).ConfigureAwait(false); + } + else + { + foreach (var child in Children) + { + await child.WriteXml(writer, cancellationToken).ConfigureAwait(false); + } + } + + await writer.WriteEndElementAsync().ConfigureAwait(false); + } +#endif + + private static XmlWriterSettings GetXmlWriterSettings(SaveOptions saveOptions) + { + XmlWriterSettings settings = new XmlWriterSettings(); + settings.Encoding = Encoding.UTF8; + if ((saveOptions & SaveOptions.DisableFormatting) == 0) settings.Indent = true; +#if !NET35 + if ((saveOptions & SaveOptions.OmitDuplicateNamespaces) != 0) + settings.NamespaceHandling |= NamespaceHandling.OmitDuplicates; +#endif + return settings; + } + + /// + /// Generate XML string from TwiML object + /// + public override string ToString() + { + return ToString(SaveOptions.None); + } + + /// + /// Generate XML string from TwiML object + /// + /// Change generated string format. + public string ToString(SaveOptions formattingOptions) + { + using (var writer = new Utf8StringWriter()) + { + Save(writer, formattingOptions); + return writer.ToString(); + } + } + } + + /// + /// StringWriter which overrides default encoding to use UTF8. + /// + public class Utf8StringWriter : StringWriter + { + public override Encoding Encoding => Encoding.UTF8; + } +} \ No newline at end of file diff --git a/src/Twilio/TwiML/Voice/Application.cs b/src/Twilio/TwiML/Voice/Application.cs index 6ff3eba1d..166c6e7ea 100644 --- a/src/Twilio/TwiML/Voice/Application.cs +++ b/src/Twilio/TwiML/Voice/Application.cs @@ -110,7 +110,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Url != null) diff --git a/src/Twilio/TwiML/Voice/Client.cs b/src/Twilio/TwiML/Voice/Client.cs index 7096b05db..dfb5a401f 100644 --- a/src/Twilio/TwiML/Voice/Client.cs +++ b/src/Twilio/TwiML/Voice/Client.cs @@ -95,7 +95,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Url != null) diff --git a/src/Twilio/TwiML/Voice/Conference.cs b/src/Twilio/TwiML/Voice/Conference.cs index f88d7814d..aa4c2a49f 100644 --- a/src/Twilio/TwiML/Voice/Conference.cs +++ b/src/Twilio/TwiML/Voice/Conference.cs @@ -293,7 +293,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Muted != null) diff --git a/src/Twilio/TwiML/Voice/Config.cs b/src/Twilio/TwiML/Voice/Config.cs index 6e1ba86a0..36aab18cb 100644 --- a/src/Twilio/TwiML/Voice/Config.cs +++ b/src/Twilio/TwiML/Voice/Config.cs @@ -39,7 +39,7 @@ public Config(string name = null, string value = null) : base("Config") /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Name != null) diff --git a/src/Twilio/TwiML/Voice/Connect.cs b/src/Twilio/TwiML/Voice/Connect.cs index 13f51e0f2..282a0927f 100644 --- a/src/Twilio/TwiML/Voice/Connect.cs +++ b/src/Twilio/TwiML/Voice/Connect.cs @@ -41,7 +41,7 @@ public Connect(Uri action = null, Twilio.Http.HttpMethod method = null) : base(" /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Action != null) diff --git a/src/Twilio/TwiML/Voice/Conversation.cs b/src/Twilio/TwiML/Voice/Conversation.cs index e631ff4b2..ad32fb468 100644 --- a/src/Twilio/TwiML/Voice/Conversation.cs +++ b/src/Twilio/TwiML/Voice/Conversation.cs @@ -188,7 +188,7 @@ public Conversation(string serviceInstanceSid = null, /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.ServiceInstanceSid != null) diff --git a/src/Twilio/TwiML/Voice/Dial.cs b/src/Twilio/TwiML/Voice/Dial.cs index 3bcd7c193..84a42f75f 100644 --- a/src/Twilio/TwiML/Voice/Dial.cs +++ b/src/Twilio/TwiML/Voice/Dial.cs @@ -275,7 +275,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Action != null) diff --git a/src/Twilio/TwiML/Voice/Enqueue.cs b/src/Twilio/TwiML/Voice/Enqueue.cs index 24d5013f3..23f9666eb 100644 --- a/src/Twilio/TwiML/Voice/Enqueue.cs +++ b/src/Twilio/TwiML/Voice/Enqueue.cs @@ -85,7 +85,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Action != null) diff --git a/src/Twilio/TwiML/Voice/Gather.cs b/src/Twilio/TwiML/Voice/Gather.cs index 0e875d3c4..2ee4a6fdb 100644 --- a/src/Twilio/TwiML/Voice/Gather.cs +++ b/src/Twilio/TwiML/Voice/Gather.cs @@ -327,7 +327,7 @@ public Gather(List input = null, /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Input != null) diff --git a/src/Twilio/TwiML/Voice/Number.cs b/src/Twilio/TwiML/Voice/Number.cs index 70a21cdb7..2c788bad0 100644 --- a/src/Twilio/TwiML/Voice/Number.cs +++ b/src/Twilio/TwiML/Voice/Number.cs @@ -159,7 +159,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.SendDigits != null) diff --git a/src/Twilio/TwiML/Voice/Parameter.cs b/src/Twilio/TwiML/Voice/Parameter.cs index 4e09c9188..4d5819643 100644 --- a/src/Twilio/TwiML/Voice/Parameter.cs +++ b/src/Twilio/TwiML/Voice/Parameter.cs @@ -39,7 +39,7 @@ public Parameter(string name = null, string value = null) : base("Parameter") /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Name != null) diff --git a/src/Twilio/TwiML/Voice/Pause.cs b/src/Twilio/TwiML/Voice/Pause.cs index b48553de1..935a1c9b4 100644 --- a/src/Twilio/TwiML/Voice/Pause.cs +++ b/src/Twilio/TwiML/Voice/Pause.cs @@ -33,7 +33,7 @@ public Pause(int? length = null) : base("Pause") /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Length != null) diff --git a/src/Twilio/TwiML/Voice/Pay.cs b/src/Twilio/TwiML/Voice/Pay.cs index fda708632..b56a19ba4 100644 --- a/src/Twilio/TwiML/Voice/Pay.cs +++ b/src/Twilio/TwiML/Voice/Pay.cs @@ -270,7 +270,7 @@ public Pay(Pay.InputEnum input = null, /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Input != null) diff --git a/src/Twilio/TwiML/Voice/Play.cs b/src/Twilio/TwiML/Voice/Play.cs index 6e9cefb47..d42197170 100644 --- a/src/Twilio/TwiML/Voice/Play.cs +++ b/src/Twilio/TwiML/Voice/Play.cs @@ -55,7 +55,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Loop != null) diff --git a/src/Twilio/TwiML/Voice/Prompt.cs b/src/Twilio/TwiML/Voice/Prompt.cs index c358cc8b8..33b8e7d0c 100644 --- a/src/Twilio/TwiML/Voice/Prompt.cs +++ b/src/Twilio/TwiML/Voice/Prompt.cs @@ -122,7 +122,7 @@ public Prompt(Prompt.ForEnum for_ = null, /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.For_ != null) diff --git a/src/Twilio/TwiML/Voice/Queue.cs b/src/Twilio/TwiML/Voice/Queue.cs index 1330fc0cd..f91d816a0 100644 --- a/src/Twilio/TwiML/Voice/Queue.cs +++ b/src/Twilio/TwiML/Voice/Queue.cs @@ -71,7 +71,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Url != null) diff --git a/src/Twilio/TwiML/Voice/Record.cs b/src/Twilio/TwiML/Voice/Record.cs index 9465cc79c..f65928028 100644 --- a/src/Twilio/TwiML/Voice/Record.cs +++ b/src/Twilio/TwiML/Voice/Record.cs @@ -141,7 +141,7 @@ public Record(Uri action = null, /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Action != null) diff --git a/src/Twilio/TwiML/Voice/Redirect.cs b/src/Twilio/TwiML/Voice/Redirect.cs index d5fb144a6..a6006387b 100644 --- a/src/Twilio/TwiML/Voice/Redirect.cs +++ b/src/Twilio/TwiML/Voice/Redirect.cs @@ -49,7 +49,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Method != null) diff --git a/src/Twilio/TwiML/Voice/Refer.cs b/src/Twilio/TwiML/Voice/Refer.cs index 5a708d763..dd36b86ef 100644 --- a/src/Twilio/TwiML/Voice/Refer.cs +++ b/src/Twilio/TwiML/Voice/Refer.cs @@ -41,7 +41,7 @@ public Refer(Uri action = null, Twilio.Http.HttpMethod method = null) : base("Re /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Action != null) diff --git a/src/Twilio/TwiML/Voice/Reject.cs b/src/Twilio/TwiML/Voice/Reject.cs index 52140d649..56de60c15 100644 --- a/src/Twilio/TwiML/Voice/Reject.cs +++ b/src/Twilio/TwiML/Voice/Reject.cs @@ -47,7 +47,7 @@ public Reject(Reject.ReasonEnum reason = null) : base("Reject") /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Reason != null) diff --git a/src/Twilio/TwiML/Voice/Room.cs b/src/Twilio/TwiML/Voice/Room.cs index 41da43f7b..2dc215b0e 100644 --- a/src/Twilio/TwiML/Voice/Room.cs +++ b/src/Twilio/TwiML/Voice/Room.cs @@ -47,7 +47,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.ParticipantIdentity != null) diff --git a/src/Twilio/TwiML/Voice/Say.cs b/src/Twilio/TwiML/Voice/Say.cs index 45de5522d..e29e1741a 100644 --- a/src/Twilio/TwiML/Voice/Say.cs +++ b/src/Twilio/TwiML/Voice/Say.cs @@ -227,7 +227,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Voice != null) diff --git a/src/Twilio/TwiML/Voice/Sip.cs b/src/Twilio/TwiML/Voice/Sip.cs index b75e839f3..954887832 100644 --- a/src/Twilio/TwiML/Voice/Sip.cs +++ b/src/Twilio/TwiML/Voice/Sip.cs @@ -159,7 +159,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Username != null) diff --git a/src/Twilio/TwiML/Voice/Siprec.cs b/src/Twilio/TwiML/Voice/Siprec.cs index 8d761df76..fb17bed58 100644 --- a/src/Twilio/TwiML/Voice/Siprec.cs +++ b/src/Twilio/TwiML/Voice/Siprec.cs @@ -60,7 +60,7 @@ public Siprec(string name = null, string connectorName = null, Siprec.TrackEnum /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Name != null) diff --git a/src/Twilio/TwiML/Voice/Sms.cs b/src/Twilio/TwiML/Voice/Sms.cs index f72235ae0..bd43c2b7d 100644 --- a/src/Twilio/TwiML/Voice/Sms.cs +++ b/src/Twilio/TwiML/Voice/Sms.cs @@ -78,7 +78,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.To != null) diff --git a/src/Twilio/TwiML/Voice/SsmlBreak.cs b/src/Twilio/TwiML/Voice/SsmlBreak.cs index 756e5ee13..05c99bc51 100644 --- a/src/Twilio/TwiML/Voice/SsmlBreak.cs +++ b/src/Twilio/TwiML/Voice/SsmlBreak.cs @@ -58,7 +58,7 @@ public SsmlBreak(SsmlBreak.StrengthEnum strength = null, string time = null) : b /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Strength != null) diff --git a/src/Twilio/TwiML/Voice/SsmlEmphasis.cs b/src/Twilio/TwiML/Voice/SsmlEmphasis.cs index 9a86d161d..fd2f7305f 100644 --- a/src/Twilio/TwiML/Voice/SsmlEmphasis.cs +++ b/src/Twilio/TwiML/Voice/SsmlEmphasis.cs @@ -62,7 +62,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Level != null) diff --git a/src/Twilio/TwiML/Voice/SsmlLang.cs b/src/Twilio/TwiML/Voice/SsmlLang.cs index aa7068030..23f879c35 100644 --- a/src/Twilio/TwiML/Voice/SsmlLang.cs +++ b/src/Twilio/TwiML/Voice/SsmlLang.cs @@ -95,7 +95,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.XmlLang != null) diff --git a/src/Twilio/TwiML/Voice/SsmlPhoneme.cs b/src/Twilio/TwiML/Voice/SsmlPhoneme.cs index 29a692199..a7e601613 100644 --- a/src/Twilio/TwiML/Voice/SsmlPhoneme.cs +++ b/src/Twilio/TwiML/Voice/SsmlPhoneme.cs @@ -71,7 +71,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Alphabet != null) diff --git a/src/Twilio/TwiML/Voice/SsmlProsody.cs b/src/Twilio/TwiML/Voice/SsmlProsody.cs index e9bd17b96..9d73ab5c2 100644 --- a/src/Twilio/TwiML/Voice/SsmlProsody.cs +++ b/src/Twilio/TwiML/Voice/SsmlProsody.cs @@ -64,7 +64,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Volume != null) diff --git a/src/Twilio/TwiML/Voice/SsmlSayAs.cs b/src/Twilio/TwiML/Voice/SsmlSayAs.cs index 753c59dc6..2ca1a87b1 100644 --- a/src/Twilio/TwiML/Voice/SsmlSayAs.cs +++ b/src/Twilio/TwiML/Voice/SsmlSayAs.cs @@ -102,7 +102,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.InterpretAs != null) diff --git a/src/Twilio/TwiML/Voice/SsmlSub.cs b/src/Twilio/TwiML/Voice/SsmlSub.cs index c71dc29e0..c1418cf66 100644 --- a/src/Twilio/TwiML/Voice/SsmlSub.cs +++ b/src/Twilio/TwiML/Voice/SsmlSub.cs @@ -48,7 +48,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Alias != null) diff --git a/src/Twilio/TwiML/Voice/SsmlW.cs b/src/Twilio/TwiML/Voice/SsmlW.cs index 8fe0ff50c..4563ab3aa 100644 --- a/src/Twilio/TwiML/Voice/SsmlW.cs +++ b/src/Twilio/TwiML/Voice/SsmlW.cs @@ -48,7 +48,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Role != null) diff --git a/src/Twilio/TwiML/Voice/Start.cs b/src/Twilio/TwiML/Voice/Start.cs index 114793d6a..d0bac2767 100644 --- a/src/Twilio/TwiML/Voice/Start.cs +++ b/src/Twilio/TwiML/Voice/Start.cs @@ -41,7 +41,7 @@ public Start(Uri action = null, Twilio.Http.HttpMethod method = null) : base("St /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Action != null) diff --git a/src/Twilio/TwiML/Voice/Stream.cs b/src/Twilio/TwiML/Voice/Stream.cs index 49d3bee8b..75c83e5e4 100644 --- a/src/Twilio/TwiML/Voice/Stream.cs +++ b/src/Twilio/TwiML/Voice/Stream.cs @@ -96,7 +96,7 @@ public Stream(string name = null, /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Name != null) diff --git a/src/Twilio/TwiML/Voice/Task.cs b/src/Twilio/TwiML/Voice/Task.cs index 49ffeca4f..8238e85df 100644 --- a/src/Twilio/TwiML/Voice/Task.cs +++ b/src/Twilio/TwiML/Voice/Task.cs @@ -54,7 +54,7 @@ protected override string GetElementBody() /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.Priority != null) diff --git a/src/Twilio/TwiML/Voice/VirtualAgent.cs b/src/Twilio/TwiML/Voice/VirtualAgent.cs index 8b7cceb55..22c5bb807 100644 --- a/src/Twilio/TwiML/Voice/VirtualAgent.cs +++ b/src/Twilio/TwiML/Voice/VirtualAgent.cs @@ -61,7 +61,7 @@ public VirtualAgent(string connectorName = null, /// /// Return the attributes of the TwiML tag /// - protected override List GetElementAttributes() + protected override IEnumerable GetElementAttributes() { var attributes = new List(); if (this.ConnectorName != null) diff --git a/src/Twilio/Twilio.csproj b/src/Twilio/Twilio.csproj index 9c276dc04..07ac05b9b 100644 --- a/src/Twilio/Twilio.csproj +++ b/src/Twilio/Twilio.csproj @@ -1,6 +1,6 @@  - netstandard1.4;netstandard2.0;net451;net35 + netstandard1.4;netstandard2.0;net451;net35;net60 true Twilio Twilio REST API helper library @@ -8,8 +8,7 @@ Twilio en-US 6.2.2 - - + Twilio $(NoWarn);CS1591 true @@ -39,6 +38,12 @@ + + + + + + diff --git a/test/Twilio.Test/TwiML/ApplicationSidTest.cs b/test/Twilio.Test/TwiML/ApplicationSidTest.cs index 19b12301a..fbb2121d0 100644 --- a/test/Twilio.Test/TwiML/ApplicationSidTest.cs +++ b/test/Twilio.Test/TwiML/ApplicationSidTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ApplicationTest.cs b/test/Twilio.Test/TwiML/ApplicationTest.cs index 30779abf0..abbaf0aa9 100644 --- a/test/Twilio.Test/TwiML/ApplicationTest.cs +++ b/test/Twilio.Test/TwiML/ApplicationTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -55,7 +55,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -73,7 +73,7 @@ public void TestElementWithChildren() "" + Environment.NewLine + "" + Environment.NewLine + " sid" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/AutopilotTest.cs b/test/Twilio.Test/TwiML/AutopilotTest.cs index c4f6ffe97..6061a66e6 100644 --- a/test/Twilio.Test/TwiML/AutopilotTest.cs +++ b/test/Twilio.Test/TwiML/AutopilotTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/BodyTest.cs b/test/Twilio.Test/TwiML/BodyTest.cs index 9bd1cd250..e8bff6e92 100644 --- a/test/Twilio.Test/TwiML/BodyTest.cs +++ b/test/Twilio.Test/TwiML/BodyTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Body(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -95,5 +96,4 @@ public void TestMixedContent() ); } } - } \ No newline at end of file diff --git a/test/Twilio.Test/TwiML/ClientTest.cs b/test/Twilio.Test/TwiML/ClientTest.cs index 02245b57b..730799871 100644 --- a/test/Twilio.Test/TwiML/ClientTest.cs +++ b/test/Twilio.Test/TwiML/ClientTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -53,7 +53,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -71,7 +71,7 @@ public void TestElementWithChildren() "" + Environment.NewLine + "" + Environment.NewLine + " client_identity" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/ConferenceTest.cs b/test/Twilio.Test/TwiML/ConferenceTest.cs index 13a77daf8..e16c96f88 100644 --- a/test/Twilio.Test/TwiML/ConferenceTest.cs +++ b/test/Twilio.Test/TwiML/ConferenceTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -68,7 +68,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ConfigTest.cs b/test/Twilio.Test/TwiML/ConfigTest.cs index d73797b6c..3fb89af75 100644 --- a/test/Twilio.Test/TwiML/ConfigTest.cs +++ b/test/Twilio.Test/TwiML/ConfigTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new Config("name", "value"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ConnectTest.cs b/test/Twilio.Test/TwiML/ConnectTest.cs index a6bc7d6e9..63029f57f 100644 --- a/test/Twilio.Test/TwiML/ConnectTest.cs +++ b/test/Twilio.Test/TwiML/ConnectTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new Connect(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -99,9 +99,9 @@ public void TestElementWithChildren() "" + Environment.NewLine + " name" + Environment.NewLine + " name" + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/ConversationTest.cs b/test/Twilio.Test/TwiML/ConversationTest.cs index 2ff34b90b..9d4e8aec4 100644 --- a/test/Twilio.Test/TwiML/ConversationTest.cs +++ b/test/Twilio.Test/TwiML/ConversationTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -47,7 +47,7 @@ public void TestElementWithParams() ); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -61,7 +61,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/DialTest.cs b/test/Twilio.Test/TwiML/DialTest.cs index fae9f591c..b47b2b3a7 100644 --- a/test/Twilio.Test/TwiML/DialTest.cs +++ b/test/Twilio.Test/TwiML/DialTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -65,7 +65,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -81,7 +81,7 @@ public void TestNestElement() "" + Environment.NewLine + "" + Environment.NewLine + " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " " + Environment.NewLine + "", elem.ToString() diff --git a/test/Twilio.Test/TwiML/EchoTest.cs b/test/Twilio.Test/TwiML/EchoTest.cs index 0a59e60e4..dfecc4687 100644 --- a/test/Twilio.Test/TwiML/EchoTest.cs +++ b/test/Twilio.Test/TwiML/EchoTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -35,7 +35,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/EnqueueTest.cs b/test/Twilio.Test/TwiML/EnqueueTest.cs index 7b3ed5b78..daf0ae7d4 100644 --- a/test/Twilio.Test/TwiML/EnqueueTest.cs +++ b/test/Twilio.Test/TwiML/EnqueueTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -54,7 +54,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/FaxResponseTest.cs b/test/Twilio.Test/TwiML/FaxResponseTest.cs index 61df4aa5f..80fb32072 100644 --- a/test/Twilio.Test/TwiML/FaxResponseTest.cs +++ b/test/Twilio.Test/TwiML/FaxResponseTest.cs @@ -22,7 +22,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -36,7 +36,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -57,7 +57,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/GatherTest.cs b/test/Twilio.Test/TwiML/GatherTest.cs index 1a7e229fb..33f1ba195 100644 --- a/test/Twilio.Test/TwiML/GatherTest.cs +++ b/test/Twilio.Test/TwiML/GatherTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -51,7 +51,7 @@ public void TestElementWithParams() ); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -65,7 +65,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -81,7 +81,7 @@ public void TestNestElement() "" + Environment.NewLine + "" + Environment.NewLine + " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " " + Environment.NewLine + "", elem.ToString() @@ -103,7 +103,7 @@ public void TestElementWithChildren() "" + Environment.NewLine + "" + Environment.NewLine + " message" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " https://example.com" + Environment.NewLine + "", elem.ToString() diff --git a/test/Twilio.Test/TwiML/HangupTest.cs b/test/Twilio.Test/TwiML/HangupTest.cs index 20aa9bead..b116ae420 100644 --- a/test/Twilio.Test/TwiML/HangupTest.cs +++ b/test/Twilio.Test/TwiML/HangupTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -35,7 +35,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -50,7 +50,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/IdentityTest.cs b/test/Twilio.Test/TwiML/IdentityTest.cs index 9051dcaab..5fd1f175e 100644 --- a/test/Twilio.Test/TwiML/IdentityTest.cs +++ b/test/Twilio.Test/TwiML/IdentityTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/LeaveTest.cs b/test/Twilio.Test/TwiML/LeaveTest.cs index 5cb620488..0dd8db4f8 100644 --- a/test/Twilio.Test/TwiML/LeaveTest.cs +++ b/test/Twilio.Test/TwiML/LeaveTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -35,7 +35,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/MediaTest.cs b/test/Twilio.Test/TwiML/MediaTest.cs index 29a979b6e..4336d712d 100644 --- a/test/Twilio.Test/TwiML/MediaTest.cs +++ b/test/Twilio.Test/TwiML/MediaTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/MessageTest.cs b/test/Twilio.Test/TwiML/MessageTest.cs index 3a299fe8c..691c07c32 100644 --- a/test/Twilio.Test/TwiML/MessageTest.cs +++ b/test/Twilio.Test/TwiML/MessageTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -53,7 +53,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/MessagingResponseTest.cs b/test/Twilio.Test/TwiML/MessagingResponseTest.cs index 49fd79c47..578ce1b82 100644 --- a/test/Twilio.Test/TwiML/MessagingResponseTest.cs +++ b/test/Twilio.Test/TwiML/MessagingResponseTest.cs @@ -22,7 +22,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -36,7 +36,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -52,7 +52,7 @@ public void TestNestElement() "" + Environment.NewLine + "" + Environment.NewLine + " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " " + Environment.NewLine + "", elem.ToString() diff --git a/test/Twilio.Test/TwiML/NumberTest.cs b/test/Twilio.Test/TwiML/NumberTest.cs index dc5fcbced..44920ed5e 100644 --- a/test/Twilio.Test/TwiML/NumberTest.cs +++ b/test/Twilio.Test/TwiML/NumberTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -62,7 +62,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ParameterTest.cs b/test/Twilio.Test/TwiML/ParameterTest.cs index a5c337068..70f12862c 100644 --- a/test/Twilio.Test/TwiML/ParameterTest.cs +++ b/test/Twilio.Test/TwiML/ParameterTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new Parameter("name", "value"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/PauseTest.cs b/test/Twilio.Test/TwiML/PauseTest.cs index 1b9505e3a..b3f153cda 100644 --- a/test/Twilio.Test/TwiML/PauseTest.cs +++ b/test/Twilio.Test/TwiML/PauseTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new Pause(1); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/PayTest.cs b/test/Twilio.Test/TwiML/PayTest.cs index 842114efc..4ac294c70 100644 --- a/test/Twilio.Test/TwiML/PayTest.cs +++ b/test/Twilio.Test/TwiML/PayTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -51,7 +51,7 @@ public void TestElementWithParams() ); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -65,7 +65,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -81,7 +81,7 @@ public void TestNestElement() "" + Environment.NewLine + "" + Environment.NewLine + " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " " + Environment.NewLine + "", elem.ToString() @@ -106,8 +106,8 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/PlayTest.cs b/test/Twilio.Test/TwiML/PlayTest.cs index e89ac63f0..a30dc9637 100644 --- a/test/Twilio.Test/TwiML/PlayTest.cs +++ b/test/Twilio.Test/TwiML/PlayTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/PromptTest.cs b/test/Twilio.Test/TwiML/PromptTest.cs index 7365cdbb0..2b1a2cc44 100644 --- a/test/Twilio.Test/TwiML/PromptTest.cs +++ b/test/Twilio.Test/TwiML/PromptTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -38,7 +38,7 @@ public void TestElementWithParams() ); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -52,7 +52,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -68,7 +68,7 @@ public void TestNestElement() "" + Environment.NewLine + "" + Environment.NewLine + " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " " + Environment.NewLine + "", elem.ToString() @@ -91,7 +91,7 @@ public void TestElementWithChildren() "" + Environment.NewLine + " message" + Environment.NewLine + " https://example.com" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/QueueTest.cs b/test/Twilio.Test/TwiML/QueueTest.cs index b7714b0e9..223c04fb1 100644 --- a/test/Twilio.Test/TwiML/QueueTest.cs +++ b/test/Twilio.Test/TwiML/QueueTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -52,7 +52,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ReceiveTest.cs b/test/Twilio.Test/TwiML/ReceiveTest.cs index 809b430e4..c3dafa4d8 100644 --- a/test/Twilio.Test/TwiML/ReceiveTest.cs +++ b/test/Twilio.Test/TwiML/ReceiveTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -38,7 +38,7 @@ public void TestElementWithParams() ); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -52,7 +52,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/RecordTest.cs b/test/Twilio.Test/TwiML/RecordTest.cs index 27d64570c..4444ef3c3 100644 --- a/test/Twilio.Test/TwiML/RecordTest.cs +++ b/test/Twilio.Test/TwiML/RecordTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -45,7 +45,7 @@ public void TestElementWithParams() ); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -59,7 +59,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/RedirectTest.cs b/test/Twilio.Test/TwiML/RedirectTest.cs index 41ce20a08..7d371228f 100644 --- a/test/Twilio.Test/TwiML/RedirectTest.cs +++ b/test/Twilio.Test/TwiML/RedirectTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ReferSipTest.cs b/test/Twilio.Test/TwiML/ReferSipTest.cs index 800dc67a6..5a19eca86 100644 --- a/test/Twilio.Test/TwiML/ReferSipTest.cs +++ b/test/Twilio.Test/TwiML/ReferSipTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ReferTest.cs b/test/Twilio.Test/TwiML/ReferTest.cs index dfe6b9746..727bf8795 100644 --- a/test/Twilio.Test/TwiML/ReferTest.cs +++ b/test/Twilio.Test/TwiML/ReferTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new Refer(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/RejectTest.cs b/test/Twilio.Test/TwiML/RejectTest.cs index 91ac2f0ee..18af14ae0 100644 --- a/test/Twilio.Test/TwiML/RejectTest.cs +++ b/test/Twilio.Test/TwiML/RejectTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new Reject(Reject.ReasonEnum.Rejected); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -61,7 +61,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/RoomTest.cs b/test/Twilio.Test/TwiML/RoomTest.cs index cb72a684b..f08e6aba2 100644 --- a/test/Twilio.Test/TwiML/RoomTest.cs +++ b/test/Twilio.Test/TwiML/RoomTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SayTest.cs b/test/Twilio.Test/TwiML/SayTest.cs index 91f67bd41..80915edf7 100644 --- a/test/Twilio.Test/TwiML/SayTest.cs +++ b/test/Twilio.Test/TwiML/SayTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -79,7 +79,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + "

words

" + Environment.NewLine + diff --git a/test/Twilio.Test/TwiML/SerializationTest.cs b/test/Twilio.Test/TwiML/SerializationTest.cs new file mode 100644 index 000000000..811837592 --- /dev/null +++ b/test/Twilio.Test/TwiML/SerializationTest.cs @@ -0,0 +1,256 @@ +using NUnit.Framework; +using System; +using System.IO; +using System.Threading; +using System.Xml.Linq; +using Twilio.Converters; +using Twilio.TwiML; +using Twilio.TwiML.Voice; + +namespace Twilio.Tests.TwiML +{ + [TestFixture] + public class SerializationTest : TwilioTest + { + private Twilio.TwiML.TwiML twiml; + private string twimlOutput; + + public SerializationTest() + { + var elem = new VoiceResponse(); + + elem.Connect(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get); + + elem.Dial( + "number", + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + 1, + true, + 1, + "caller_id", + Dial.RecordEnum.DoNotRecord, + Dial.TrimEnum.TrimSilence, + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + Promoter.ListOfOne(Dial.RecordingEventEnum.InProgress), + true, + Dial.RingToneEnum.At, + Dial.RecordingTrackEnum.Both, + true, + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get + ); + + elem.Echo(); + + elem.Enqueue( + "name", + new Uri("https://example.com"), + 1, + Twilio.Http.HttpMethod.Get, + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + "workflow_sid" + ); + + elem.Gather( + Promoter.ListOfOne(Gather.InputEnum.Dtmf), + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + 1, + "speech_timeout", + 1, + true, + "finish_on_key", + 1, + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + Gather.LanguageEnum.AfZa, + "hints", + true, + true, + true, + Gather.SpeechModelEnum.Default, + true + ); + + elem.Hangup(); + + elem.Leave(); + + elem.Pause(1); + + elem.Play(new Uri("https://example.com"), 1, "digits"); + + elem.Queue( + "name", + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + "reservation_sid", + "post_work_activity_sid" + ); + + elem.Record( + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + 1, + "finish_on_key", + 1, + true, + Record.TrimEnum.TrimSilence, + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + Promoter.ListOfOne(Record.RecordingEventEnum.InProgress), + true, + new Uri("https://example.com") + ); + + elem.Redirect(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get); + + elem.Reject(Reject.ReasonEnum.Rejected); + + elem.Say("message", Say.VoiceEnum.Man, 1, Say.LanguageEnum.Arb); + + elem.Sms( + "message", + new Twilio.Types.PhoneNumber("+15558675310"), + new Twilio.Types.PhoneNumber("+15017122661"), + new Uri("https://example.com"), + Twilio.Http.HttpMethod.Get, + new Uri("https://example.com") + ); + + elem.Pay( + Pay.InputEnum.Dtmf, + new Uri("https://example.com"), + Pay.BankAccountTypeEnum.ConsumerChecking, + new Uri("https://example.com"), + Pay.StatusCallbackMethodEnum.Get, + 1, + 1, + true, + "postal_code", + 1, + "payment_connector", + Pay.PaymentMethodEnum.AchDebit, + Pay.TokenTypeEnum.OneTime, + "charge_amount", + "currency", + "description", + Promoter.ListOfOne(Pay.ValidCardTypesEnum.Visa), + Pay.LanguageEnum.DeDe + ); + + elem.Prompt( + Prompt.ForEnum.PaymentCardNumber, + Promoter.ListOfOne(Prompt.ErrorTypeEnum.Timeout), + Promoter.ListOfOne(Prompt.CardTypeEnum.Visa), + Promoter.ListOfOne(1), + true + ); + + elem.Start(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get); + + elem.Stop(); + + elem.Refer(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get); + + twiml = elem; + + twimlOutput = "" + Environment.NewLine + + "" + Environment.NewLine + + " " + Environment.NewLine + + " number" + + Environment.NewLine + + " " + Environment.NewLine + + " name" + + Environment.NewLine + + " " + + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " https://example.com" + Environment.NewLine + + " name" + + Environment.NewLine + + " " + + Environment.NewLine + + " https://example.com" + Environment.NewLine + + " " + Environment.NewLine + + " message" + Environment.NewLine + + " message" + + Environment.NewLine + + " " + + Environment.NewLine + + " " + + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + ""; + } + + [Test] + public void TestSaveStream() + { + string output; + using (var memoryStream = new MemoryStream()) + { + twiml.Save(memoryStream); + memoryStream.Seek(0, SeekOrigin.Begin); + using (var reader = new StreamReader(memoryStream)) + { + output = reader.ReadToEnd(); + } + } + + Assert.AreEqual(twimlOutput, output); + } + + [Test] + public void TestSaveTextWriter() + { + string output; + using (var writer = new Utf8StringWriter()) + { + twiml.Save(writer); + output = writer.ToString(); + } + + Assert.AreEqual(twimlOutput, output); + } + +#if !NET35 + [Test] + public async System.Threading.Tasks.Task TestSaveAsyncStream() + { + string output; + using (var memoryStream = new MemoryStream()) + { + await twiml.SaveAsync(memoryStream, CancellationToken.None); + memoryStream.Seek(0, SeekOrigin.Begin); + using (var reader = new StreamReader(memoryStream)) + { + output = await reader.ReadToEndAsync(); + } + } + + Assert.AreEqual(twimlOutput, output); + } + + [Test] + public async System.Threading.Tasks.Task TestSaveAsyncTextWriter() + { + string output; + using (var writer = new Utf8StringWriter()) + { + await twiml.SaveAsync(writer, CancellationToken.None); + output = writer.ToString(); + } + + Assert.AreEqual(twimlOutput, output); + } +#endif + } +} \ No newline at end of file diff --git a/test/Twilio.Test/TwiML/SimTest.cs b/test/Twilio.Test/TwiML/SimTest.cs index 82ff3fa42..f2e86d3b0 100644 --- a/test/Twilio.Test/TwiML/SimTest.cs +++ b/test/Twilio.Test/TwiML/SimTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SipTest.cs b/test/Twilio.Test/TwiML/SipTest.cs index cb81191d6..cacee6d4f 100644 --- a/test/Twilio.Test/TwiML/SipTest.cs +++ b/test/Twilio.Test/TwiML/SipTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -62,7 +62,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SiprecTest.cs b/test/Twilio.Test/TwiML/SiprecTest.cs index 36a3be33d..b474e3a6c 100644 --- a/test/Twilio.Test/TwiML/SiprecTest.cs +++ b/test/Twilio.Test/TwiML/SiprecTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new Siprec("name", "connector_name", Siprec.TrackEnum.InboundTrack); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -61,7 +61,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/SmsTest.cs b/test/Twilio.Test/TwiML/SmsTest.cs index 7737faee8..f7934b43c 100644 --- a/test/Twilio.Test/TwiML/SmsTest.cs +++ b/test/Twilio.Test/TwiML/SmsTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -53,7 +53,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlBreakTest.cs b/test/Twilio.Test/TwiML/SsmlBreakTest.cs index 47de34aba..a3848b2d2 100644 --- a/test/Twilio.Test/TwiML/SsmlBreakTest.cs +++ b/test/Twilio.Test/TwiML/SsmlBreakTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new SsmlBreak(SsmlBreak.StrengthEnum.None, "time"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlEmphasisTest.cs b/test/Twilio.Test/TwiML/SsmlEmphasisTest.cs index 68603357e..177c51d7e 100644 --- a/test/Twilio.Test/TwiML/SsmlEmphasisTest.cs +++ b/test/Twilio.Test/TwiML/SsmlEmphasisTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -75,7 +75,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + diff --git a/test/Twilio.Test/TwiML/SsmlLangTest.cs b/test/Twilio.Test/TwiML/SsmlLangTest.cs index bf25e8cff..30cfd54f5 100644 --- a/test/Twilio.Test/TwiML/SsmlLangTest.cs +++ b/test/Twilio.Test/TwiML/SsmlLangTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -79,7 +79,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + "

words

" + Environment.NewLine + diff --git a/test/Twilio.Test/TwiML/SsmlPTest.cs b/test/Twilio.Test/TwiML/SsmlPTest.cs index 9534890a8..81841d8b6 100644 --- a/test/Twilio.Test/TwiML/SsmlPTest.cs +++ b/test/Twilio.Test/TwiML/SsmlPTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "

", + "

", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "

", + "

", elem.ToString() ); } @@ -77,7 +77,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "

" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + diff --git a/test/Twilio.Test/TwiML/SsmlPhonemeTest.cs b/test/Twilio.Test/TwiML/SsmlPhonemeTest.cs index 2469c3299..f1db84c52 100644 --- a/test/Twilio.Test/TwiML/SsmlPhonemeTest.cs +++ b/test/Twilio.Test/TwiML/SsmlPhonemeTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlProsodyTest.cs b/test/Twilio.Test/TwiML/SsmlProsodyTest.cs index 1693cd6d8..324ddea7f 100644 --- a/test/Twilio.Test/TwiML/SsmlProsodyTest.cs +++ b/test/Twilio.Test/TwiML/SsmlProsodyTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -79,7 +79,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + "

words

" + Environment.NewLine + diff --git a/test/Twilio.Test/TwiML/SsmlSTest.cs b/test/Twilio.Test/TwiML/SsmlSTest.cs index 75a385799..fe22d57b5 100644 --- a/test/Twilio.Test/TwiML/SsmlSTest.cs +++ b/test/Twilio.Test/TwiML/SsmlSTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -75,7 +75,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + diff --git a/test/Twilio.Test/TwiML/SsmlSayAsTest.cs b/test/Twilio.Test/TwiML/SsmlSayAsTest.cs index 53a5e78eb..c53c859ac 100644 --- a/test/Twilio.Test/TwiML/SsmlSayAsTest.cs +++ b/test/Twilio.Test/TwiML/SsmlSayAsTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlSubTest.cs b/test/Twilio.Test/TwiML/SsmlSubTest.cs index 42a04f44d..59593bca1 100644 --- a/test/Twilio.Test/TwiML/SsmlSubTest.cs +++ b/test/Twilio.Test/TwiML/SsmlSubTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlWTest.cs b/test/Twilio.Test/TwiML/SsmlWTest.cs index 52bee0a20..7b680bd44 100644 --- a/test/Twilio.Test/TwiML/SsmlWTest.cs +++ b/test/Twilio.Test/TwiML/SsmlWTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -71,7 +71,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + " words" + Environment.NewLine + diff --git a/test/Twilio.Test/TwiML/StartTest.cs b/test/Twilio.Test/TwiML/StartTest.cs index 0e6636434..3b5b1d79d 100644 --- a/test/Twilio.Test/TwiML/StartTest.cs +++ b/test/Twilio.Test/TwiML/StartTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -32,7 +32,7 @@ public void TestElementWithParams() var elem = new Start(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -62,7 +62,7 @@ public void TestNestElement() "" + Environment.NewLine + "" + Environment.NewLine + " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " " + Environment.NewLine + "", elem.ToString() @@ -88,8 +88,8 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/StopTest.cs b/test/Twilio.Test/TwiML/StopTest.cs index 7567c8f91..aab49dd8a 100644 --- a/test/Twilio.Test/TwiML/StopTest.cs +++ b/test/Twilio.Test/TwiML/StopTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -35,7 +35,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -51,7 +51,7 @@ public void TestNestElement() "" + Environment.NewLine + "" + Environment.NewLine + " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " " + Environment.NewLine + "", elem.ToString() @@ -77,8 +77,8 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/StreamTest.cs b/test/Twilio.Test/TwiML/StreamTest.cs index a77bdf268..9add99695 100644 --- a/test/Twilio.Test/TwiML/StreamTest.cs +++ b/test/Twilio.Test/TwiML/StreamTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -39,7 +39,7 @@ public void TestElementWithParams() ); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -53,7 +53,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -68,7 +68,7 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/TaskTest.cs b/test/Twilio.Test/TwiML/TaskTest.cs index f220a3a97..f9eaa5961 100644 --- a/test/Twilio.Test/TwiML/TaskTest.cs +++ b/test/Twilio.Test/TwiML/TaskTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -46,7 +46,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/VirtualAgentTest.cs b/test/Twilio.Test/TwiML/VirtualAgentTest.cs index f96b53a9b..5e4e4ee9e 100644 --- a/test/Twilio.Test/TwiML/VirtualAgentTest.cs +++ b/test/Twilio.Test/TwiML/VirtualAgentTest.cs @@ -21,7 +21,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -38,7 +38,7 @@ public void TestElementWithParams() ); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -52,7 +52,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -69,8 +69,8 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/VoiceResponseTest.cs b/test/Twilio.Test/TwiML/VoiceResponseTest.cs index 6779d8c47..5a6ee713e 100644 --- a/test/Twilio.Test/TwiML/VoiceResponseTest.cs +++ b/test/Twilio.Test/TwiML/VoiceResponseTest.cs @@ -22,7 +22,7 @@ public void TestEmptyElement() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -36,7 +36,7 @@ public void TestElementWithExtraAttributes() Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -52,7 +52,7 @@ public void TestNestElement() "" + Environment.NewLine + "" + Environment.NewLine + " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " " + Environment.NewLine + "", elem.ToString() @@ -204,26 +204,26 @@ public void TestElementWithChildren() Assert.AreEqual( "" + Environment.NewLine + "" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " number" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " name" + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + " https://example.com" + Environment.NewLine + " name" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " https://example.com" + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + " message" + Environment.NewLine + " message" + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + - " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + + " " + Environment.NewLine + "", elem.ToString() ); diff --git a/test/Twilio.Test/TwiML/XmlEscapeTest.cs b/test/Twilio.Test/TwiML/XmlEscapeTest.cs new file mode 100644 index 000000000..509de6ee8 --- /dev/null +++ b/test/Twilio.Test/TwiML/XmlEscapeTest.cs @@ -0,0 +1,36 @@ +using NUnit.Framework; +using System; +using Twilio.TwiML.Messaging; + +namespace Twilio.Tests.TwiML +{ + [TestFixture] + public class XmlEscapeTest : TwilioTest + { + [Test] + public void TestXmlEscapedBodyMessage() + { + var elem = new Message(""); + + Assert.AreEqual( + "" + Environment.NewLine + + "<InvalidBodyMessage></InvalidBodyMessage>", + elem.ToString() + ); + } + + [Test] + public void TestXmlEscapedText() + { + var elem = new Message(); + elem.AddText(""); + + Assert.AreEqual( + "" + Environment.NewLine + + "<InvalidText></InvalidText>", + elem.ToString() + ); + } + } + +} \ No newline at end of file diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index 3b44e7ec9..e35dc1257 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -2,21 +2,22 @@ Exe Twilio.Tests - netcoreapp2.0;net451;net35 + net451;net35;net60 win7-x86 win7-x86 false + false - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - - - + + + + + From 8816ba14e5c942350d6cf2c62f0e494d0f3ecece Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Thu, 2 Feb 2023 12:36:46 -0500 Subject: [PATCH 2/3] Document methods --- src/Twilio/TwiML/TwiMLSerializer.cs | 146 +++++++++++++++++++--------- 1 file changed, 102 insertions(+), 44 deletions(-) diff --git a/src/Twilio/TwiML/TwiMLSerializer.cs b/src/Twilio/TwiML/TwiMLSerializer.cs index 37ad002b1..5bf4818fb 100644 --- a/src/Twilio/TwiML/TwiMLSerializer.cs +++ b/src/Twilio/TwiML/TwiMLSerializer.cs @@ -21,8 +21,8 @@ public partial class TwiML /// /// Attribute names to be transformed on the generated xml /// - private static Dictionary AttributeNameMapper = new Dictionary {{"for_", "for"}}; - + private static Dictionary AttributeNameMapper = new Dictionary { { "for_", "for" } }; + /// /// Generate XElement from TwiML object /// @@ -31,7 +31,7 @@ protected virtual XNode ToXml() { var elem = new XElement(TagName, GetElementBody()); - foreach(var attr in GetElementAttributes()) + foreach (var attr in GetElementAttributes()) { string transformedAttr = attr.Name.LocalName; if (AttributeNameMapper.TryGetValue(attr.Name.LocalName, out transformedAttr)) @@ -72,45 +72,66 @@ public XDocument ToXDocument() var elem = ToXml(); var document = new XDocument(declaration, elem); return document; - } - + } + + /// + /// Write TwiML to TextWriter as XML. + /// + /// TextWriter to write XML string to. public void Save(TextWriter textWriter) { Save(textWriter, SaveOptions.None); - } - - public void Save(TextWriter textWriter, SaveOptions options) + } + + /// + /// Write TwiML to TextWriter as XML. + /// + /// TextWriter to write XML string to. + /// Change generated string format. + public void Save(TextWriter textWriter, SaveOptions formattingOptions) { - var ws = GetXmlWriterSettings(options); + var ws = GetXmlWriterSettings(formattingOptions); using (var writer = XmlWriter.Create(textWriter, ws)) - Save(writer, options); - } - + Save(writer); + } + + /// + /// Write TwiML to Stream as XML. + /// + /// Stream to write XML string to. public void Save(Stream stream) { Save(stream, SaveOptions.None); - } - - public void Save(Stream stream, SaveOptions options) + } + + /// + /// Write TwiML to Stream as XML. + /// + /// Stream to write XML string to. + /// Change generated string format. + public void Save(Stream stream, SaveOptions formattingOptions) { - var ws = GetXmlWriterSettings(options); + var ws = GetXmlWriterSettings(formattingOptions); using (var writer = XmlWriter.Create(stream, ws)) - Save(writer, options); - } - + Save(writer); + } + + /// + /// Write TwiML to XmlWriter as XML. Configure the XmlWriter before invoking Save. + /// + /// XmlWriter to write XML string to. public void Save(XmlWriter writer) - { - Save(writer, SaveOptions.None); - } - - public void Save(XmlWriter writer, SaveOptions options) { writer.WriteStartDocument(); WriteContent(writer); writer.WriteEndDocument(); writer.Flush(); - } - + } + + /// + /// Write the Element, Attributes, and inner XML of this TwiML object. + /// + /// XmlWriter to write XML string to. protected virtual void WriteContent(XmlWriter writer) { writer.WriteStartElement(null, TagName, null); @@ -172,15 +193,30 @@ protected virtual void WriteContent(XmlWriter writer) writer.WriteEndElement(); } -#if !NET35 +#if !NET35 + /// + /// Write TwiML to TextWriter as XML. + /// + /// TextWriter to write XML string to. + /// A cancellation token. public Task SaveAsync(TextWriter textWriter, CancellationToken cancellationToken) { return SaveAsync(textWriter, SaveOptions.None, cancellationToken); - } - - public async Task SaveAsync(TextWriter textWriter, SaveOptions options, CancellationToken cancellationToken) + } + + /// + /// Write TwiML to TextWriter as XML. + /// + /// TextWriter to write XML string to. + /// Change generated string format. + /// A cancellation token. + public async Task SaveAsync( + TextWriter textWriter, SaveOptions + formattingOptions, + CancellationToken cancellationToken + ) { - var ws = GetXmlWriterSettings(options); + var ws = GetXmlWriterSettings(formattingOptions); ws.Async = true; var writer = XmlWriter.Create(textWriter, ws); #if NET6_0_OR_GREATER @@ -192,16 +228,27 @@ public async Task SaveAsync(TextWriter textWriter, SaveOptions options, Cancella #endif await SaveAsync(writer, cancellationToken).ConfigureAwait(false); } - } - + } + + /// + /// Write TwiML to Stream as XML. + /// + /// Stream to write XML string to. + /// A cancellation token. public Task SaveAsync(Stream stream, CancellationToken cancellationToken) { return SaveAsync(stream, SaveOptions.None, cancellationToken); - } - - public async Task SaveAsync(Stream stream, SaveOptions options, CancellationToken cancellationToken) + } + + /// + /// Write TwiML to Stream as XML. + /// + /// Stream to write XML string to. + /// Change generated string format. + /// A cancellation token. + public async Task SaveAsync(Stream stream, SaveOptions formattingOptions, CancellationToken cancellationToken) { - var ws = GetXmlWriterSettings(options); + var ws = GetXmlWriterSettings(formattingOptions); ws.Async = true; var writer = XmlWriter.Create(stream, ws); #if NET6_0_OR_GREATER @@ -213,16 +260,26 @@ public async Task SaveAsync(Stream stream, SaveOptions options, CancellationToke #endif await SaveAsync(writer, cancellationToken).ConfigureAwait(false); } - } - + } + + /// + /// Write TwiML to XmlWriter as XML. Configure the XmlWriter before invoking Save. + /// + /// XmlWriter to write XML string to. + /// A cancellation token. public async Task SaveAsync(XmlWriter writer, CancellationToken cancellationToken) { await writer.WriteStartDocumentAsync().ConfigureAwait(false); await WriteXml(writer, cancellationToken).ConfigureAwait(false); await writer.WriteEndDocumentAsync().ConfigureAwait(false); await writer.FlushAsync().ConfigureAwait(false); - } - + } + + /// + /// Write the Element, Attributes, and inner XML of this TwiML object. + /// + /// XmlWriter to write XML string to. + /// A cancellation token. protected virtual async Task WriteXml(XmlWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -292,6 +349,7 @@ private static XmlWriterSettings GetXmlWriterSettings(SaveOptions saveOptions) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; + if ((saveOptions & SaveOptions.DisableFormatting) == 0) settings.Indent = true; #if !NET35 if ((saveOptions & SaveOptions.OmitDuplicateNamespaces) != 0) @@ -301,7 +359,7 @@ private static XmlWriterSettings GetXmlWriterSettings(SaveOptions saveOptions) } /// - /// Generate XML string from TwiML object + /// Generate XML string from TwiML object. /// public override string ToString() { @@ -309,9 +367,9 @@ public override string ToString() } /// - /// Generate XML string from TwiML object + /// Generate XML string from TwiML object. /// - /// Change generated string format. + /// Change generated string format. public string ToString(SaveOptions formattingOptions) { using (var writer = new Utf8StringWriter()) From 4a05866ba7131605fe55b47899bbed6b1d56c01c Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Tue, 6 Jun 2023 18:17:53 -0400 Subject: [PATCH 3/3] add xml:lang attr to tests --- test/Twilio.Test/TwiML/ApplicationSidTest.cs | 3 ++- test/Twilio.Test/TwiML/ApplicationTest.cs | 3 ++- test/Twilio.Test/TwiML/AutopilotTest.cs | 3 ++- test/Twilio.Test/TwiML/BodyTest.cs | 1 + test/Twilio.Test/TwiML/ClientTest.cs | 3 ++- test/Twilio.Test/TwiML/ConferenceTest.cs | 3 ++- test/Twilio.Test/TwiML/ConfigTest.cs | 3 ++- test/Twilio.Test/TwiML/ConnectTest.cs | 3 ++- test/Twilio.Test/TwiML/ConversationTest.cs | 3 ++- test/Twilio.Test/TwiML/DialTest.cs | 3 ++- test/Twilio.Test/TwiML/EchoTest.cs | 3 ++- test/Twilio.Test/TwiML/EnqueueTest.cs | 3 ++- test/Twilio.Test/TwiML/FaxResponseTest.cs | 3 ++- test/Twilio.Test/TwiML/GatherTest.cs | 3 ++- test/Twilio.Test/TwiML/HangupTest.cs | 3 ++- test/Twilio.Test/TwiML/IdentityTest.cs | 3 ++- test/Twilio.Test/TwiML/LeaveTest.cs | 3 ++- test/Twilio.Test/TwiML/MediaTest.cs | 3 ++- test/Twilio.Test/TwiML/MessageTest.cs | 3 ++- test/Twilio.Test/TwiML/MessagingResponseTest.cs | 3 ++- test/Twilio.Test/TwiML/NumberTest.cs | 3 ++- test/Twilio.Test/TwiML/ParameterTest.cs | 3 ++- test/Twilio.Test/TwiML/PauseTest.cs | 3 ++- test/Twilio.Test/TwiML/PayTest.cs | 3 ++- test/Twilio.Test/TwiML/PlayTest.cs | 3 ++- test/Twilio.Test/TwiML/PromptTest.cs | 3 ++- test/Twilio.Test/TwiML/QueueTest.cs | 3 ++- test/Twilio.Test/TwiML/ReceiveTest.cs | 3 ++- test/Twilio.Test/TwiML/RecordTest.cs | 3 ++- test/Twilio.Test/TwiML/RedirectTest.cs | 3 ++- test/Twilio.Test/TwiML/ReferSipTest.cs | 3 ++- test/Twilio.Test/TwiML/ReferTest.cs | 3 ++- test/Twilio.Test/TwiML/RejectTest.cs | 3 ++- test/Twilio.Test/TwiML/RoomTest.cs | 3 ++- test/Twilio.Test/TwiML/SayTest.cs | 3 ++- test/Twilio.Test/TwiML/SimTest.cs | 3 ++- test/Twilio.Test/TwiML/SipTest.cs | 3 ++- test/Twilio.Test/TwiML/SiprecTest.cs | 3 ++- test/Twilio.Test/TwiML/SmsTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlBreakTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlEmphasisTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlLangTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlPTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlPhonemeTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlProsodyTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlSTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlSayAsTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlSubTest.cs | 3 ++- test/Twilio.Test/TwiML/SsmlWTest.cs | 3 ++- test/Twilio.Test/TwiML/StartTest.cs | 3 ++- test/Twilio.Test/TwiML/StopTest.cs | 3 ++- test/Twilio.Test/TwiML/StreamTest.cs | 3 ++- test/Twilio.Test/TwiML/TaskTest.cs | 3 ++- test/Twilio.Test/TwiML/VirtualAgentTest.cs | 3 ++- test/Twilio.Test/TwiML/VoiceResponseTest.cs | 5 +++-- test/Twilio.Test/Twilio.Test.csproj | 2 +- 56 files changed, 111 insertions(+), 56 deletions(-) diff --git a/test/Twilio.Test/TwiML/ApplicationSidTest.cs b/test/Twilio.Test/TwiML/ApplicationSidTest.cs index fbb2121d0..a8b0e01dd 100644 --- a/test/Twilio.Test/TwiML/ApplicationSidTest.cs +++ b/test/Twilio.Test/TwiML/ApplicationSidTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new ApplicationSid(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ApplicationTest.cs b/test/Twilio.Test/TwiML/ApplicationTest.cs index 1d1317534..f9d2c85f8 100644 --- a/test/Twilio.Test/TwiML/ApplicationTest.cs +++ b/test/Twilio.Test/TwiML/ApplicationTest.cs @@ -52,10 +52,11 @@ public void TestElementWithExtraAttributes() var elem = new Application(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/AutopilotTest.cs b/test/Twilio.Test/TwiML/AutopilotTest.cs index 6061a66e6..2b19858e6 100644 --- a/test/Twilio.Test/TwiML/AutopilotTest.cs +++ b/test/Twilio.Test/TwiML/AutopilotTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Autopilot(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/BodyTest.cs b/test/Twilio.Test/TwiML/BodyTest.cs index e8bff6e92..72c6480cb 100644 --- a/test/Twilio.Test/TwiML/BodyTest.cs +++ b/test/Twilio.Test/TwiML/BodyTest.cs @@ -96,4 +96,5 @@ public void TestMixedContent() ); } } + } \ No newline at end of file diff --git a/test/Twilio.Test/TwiML/ClientTest.cs b/test/Twilio.Test/TwiML/ClientTest.cs index b3f2d013a..e95318edc 100644 --- a/test/Twilio.Test/TwiML/ClientTest.cs +++ b/test/Twilio.Test/TwiML/ClientTest.cs @@ -50,10 +50,11 @@ public void TestElementWithExtraAttributes() var elem = new Client(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ConferenceTest.cs b/test/Twilio.Test/TwiML/ConferenceTest.cs index d76246f0d..9fbc9337f 100644 --- a/test/Twilio.Test/TwiML/ConferenceTest.cs +++ b/test/Twilio.Test/TwiML/ConferenceTest.cs @@ -65,10 +65,11 @@ public void TestElementWithExtraAttributes() var elem = new Conference(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ConfigTest.cs b/test/Twilio.Test/TwiML/ConfigTest.cs index 3fb89af75..4d9a8613a 100644 --- a/test/Twilio.Test/TwiML/ConfigTest.cs +++ b/test/Twilio.Test/TwiML/ConfigTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Config(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ConnectTest.cs b/test/Twilio.Test/TwiML/ConnectTest.cs index 0db081ed2..e53fbc209 100644 --- a/test/Twilio.Test/TwiML/ConnectTest.cs +++ b/test/Twilio.Test/TwiML/ConnectTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Connect(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ConversationTest.cs b/test/Twilio.Test/TwiML/ConversationTest.cs index 4cdfe51d4..58e399997 100644 --- a/test/Twilio.Test/TwiML/ConversationTest.cs +++ b/test/Twilio.Test/TwiML/ConversationTest.cs @@ -58,10 +58,11 @@ public void TestElementWithExtraAttributes() var elem = new Conversation(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/DialTest.cs b/test/Twilio.Test/TwiML/DialTest.cs index f70afc2fc..962cc6be8 100644 --- a/test/Twilio.Test/TwiML/DialTest.cs +++ b/test/Twilio.Test/TwiML/DialTest.cs @@ -62,10 +62,11 @@ public void TestElementWithExtraAttributes() var elem = new Dial(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/EchoTest.cs b/test/Twilio.Test/TwiML/EchoTest.cs index dfecc4687..c88f8b31f 100644 --- a/test/Twilio.Test/TwiML/EchoTest.cs +++ b/test/Twilio.Test/TwiML/EchoTest.cs @@ -32,10 +32,11 @@ public void TestElementWithExtraAttributes() var elem = new Echo(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/EnqueueTest.cs b/test/Twilio.Test/TwiML/EnqueueTest.cs index daf0ae7d4..6a1858585 100644 --- a/test/Twilio.Test/TwiML/EnqueueTest.cs +++ b/test/Twilio.Test/TwiML/EnqueueTest.cs @@ -51,10 +51,11 @@ public void TestElementWithExtraAttributes() var elem = new Enqueue(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/FaxResponseTest.cs b/test/Twilio.Test/TwiML/FaxResponseTest.cs index 80fb32072..553ec50b6 100644 --- a/test/Twilio.Test/TwiML/FaxResponseTest.cs +++ b/test/Twilio.Test/TwiML/FaxResponseTest.cs @@ -33,10 +33,11 @@ public void TestElementWithExtraAttributes() var elem = new FaxResponse(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/GatherTest.cs b/test/Twilio.Test/TwiML/GatherTest.cs index 04bcaac04..f728f1dc0 100644 --- a/test/Twilio.Test/TwiML/GatherTest.cs +++ b/test/Twilio.Test/TwiML/GatherTest.cs @@ -62,10 +62,11 @@ public void TestElementWithExtraAttributes() var elem = new Gather(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/HangupTest.cs b/test/Twilio.Test/TwiML/HangupTest.cs index b116ae420..1e572fa47 100644 --- a/test/Twilio.Test/TwiML/HangupTest.cs +++ b/test/Twilio.Test/TwiML/HangupTest.cs @@ -32,10 +32,11 @@ public void TestElementWithExtraAttributes() var elem = new Hangup(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/IdentityTest.cs b/test/Twilio.Test/TwiML/IdentityTest.cs index 5fd1f175e..6b036ca3e 100644 --- a/test/Twilio.Test/TwiML/IdentityTest.cs +++ b/test/Twilio.Test/TwiML/IdentityTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Identity(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/LeaveTest.cs b/test/Twilio.Test/TwiML/LeaveTest.cs index 0dd8db4f8..f68d76d2f 100644 --- a/test/Twilio.Test/TwiML/LeaveTest.cs +++ b/test/Twilio.Test/TwiML/LeaveTest.cs @@ -32,10 +32,11 @@ public void TestElementWithExtraAttributes() var elem = new Leave(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/MediaTest.cs b/test/Twilio.Test/TwiML/MediaTest.cs index 4336d712d..2e461b051 100644 --- a/test/Twilio.Test/TwiML/MediaTest.cs +++ b/test/Twilio.Test/TwiML/MediaTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Media(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/MessageTest.cs b/test/Twilio.Test/TwiML/MessageTest.cs index 691c07c32..d7c619cdb 100644 --- a/test/Twilio.Test/TwiML/MessageTest.cs +++ b/test/Twilio.Test/TwiML/MessageTest.cs @@ -50,10 +50,11 @@ public void TestElementWithExtraAttributes() var elem = new Message(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/MessagingResponseTest.cs b/test/Twilio.Test/TwiML/MessagingResponseTest.cs index 578ce1b82..b7abe7182 100644 --- a/test/Twilio.Test/TwiML/MessagingResponseTest.cs +++ b/test/Twilio.Test/TwiML/MessagingResponseTest.cs @@ -33,10 +33,11 @@ public void TestElementWithExtraAttributes() var elem = new MessagingResponse(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/NumberTest.cs b/test/Twilio.Test/TwiML/NumberTest.cs index 641e738a1..1ac86c254 100644 --- a/test/Twilio.Test/TwiML/NumberTest.cs +++ b/test/Twilio.Test/TwiML/NumberTest.cs @@ -59,10 +59,11 @@ public void TestElementWithExtraAttributes() var elem = new Number(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ParameterTest.cs b/test/Twilio.Test/TwiML/ParameterTest.cs index 70f12862c..108772ce3 100644 --- a/test/Twilio.Test/TwiML/ParameterTest.cs +++ b/test/Twilio.Test/TwiML/ParameterTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Parameter(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/PauseTest.cs b/test/Twilio.Test/TwiML/PauseTest.cs index b3f153cda..53761439d 100644 --- a/test/Twilio.Test/TwiML/PauseTest.cs +++ b/test/Twilio.Test/TwiML/PauseTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Pause(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/PayTest.cs b/test/Twilio.Test/TwiML/PayTest.cs index b80d63d1f..affdbefde 100644 --- a/test/Twilio.Test/TwiML/PayTest.cs +++ b/test/Twilio.Test/TwiML/PayTest.cs @@ -62,10 +62,11 @@ public void TestElementWithExtraAttributes() var elem = new Pay(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/PlayTest.cs b/test/Twilio.Test/TwiML/PlayTest.cs index a30dc9637..2051fe6f6 100644 --- a/test/Twilio.Test/TwiML/PlayTest.cs +++ b/test/Twilio.Test/TwiML/PlayTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Play(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/PromptTest.cs b/test/Twilio.Test/TwiML/PromptTest.cs index 4fc2aa0d9..368cf134f 100644 --- a/test/Twilio.Test/TwiML/PromptTest.cs +++ b/test/Twilio.Test/TwiML/PromptTest.cs @@ -49,10 +49,11 @@ public void TestElementWithExtraAttributes() var elem = new Prompt(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/QueueTest.cs b/test/Twilio.Test/TwiML/QueueTest.cs index 223c04fb1..8394499a6 100644 --- a/test/Twilio.Test/TwiML/QueueTest.cs +++ b/test/Twilio.Test/TwiML/QueueTest.cs @@ -49,10 +49,11 @@ public void TestElementWithExtraAttributes() var elem = new Queue(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ReceiveTest.cs b/test/Twilio.Test/TwiML/ReceiveTest.cs index c3dafa4d8..cb273972a 100644 --- a/test/Twilio.Test/TwiML/ReceiveTest.cs +++ b/test/Twilio.Test/TwiML/ReceiveTest.cs @@ -49,10 +49,11 @@ public void TestElementWithExtraAttributes() var elem = new Receive(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/RecordTest.cs b/test/Twilio.Test/TwiML/RecordTest.cs index 5166c4824..319f48274 100644 --- a/test/Twilio.Test/TwiML/RecordTest.cs +++ b/test/Twilio.Test/TwiML/RecordTest.cs @@ -56,10 +56,11 @@ public void TestElementWithExtraAttributes() var elem = new Record(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/RedirectTest.cs b/test/Twilio.Test/TwiML/RedirectTest.cs index 7d371228f..d19b555d4 100644 --- a/test/Twilio.Test/TwiML/RedirectTest.cs +++ b/test/Twilio.Test/TwiML/RedirectTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Redirect(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ReferSipTest.cs b/test/Twilio.Test/TwiML/ReferSipTest.cs index 5a19eca86..988ca399f 100644 --- a/test/Twilio.Test/TwiML/ReferSipTest.cs +++ b/test/Twilio.Test/TwiML/ReferSipTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new ReferSip(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/ReferTest.cs b/test/Twilio.Test/TwiML/ReferTest.cs index 727bf8795..faff70453 100644 --- a/test/Twilio.Test/TwiML/ReferTest.cs +++ b/test/Twilio.Test/TwiML/ReferTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Refer(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/RejectTest.cs b/test/Twilio.Test/TwiML/RejectTest.cs index 18af14ae0..fad737b35 100644 --- a/test/Twilio.Test/TwiML/RejectTest.cs +++ b/test/Twilio.Test/TwiML/RejectTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Reject(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/RoomTest.cs b/test/Twilio.Test/TwiML/RoomTest.cs index f08e6aba2..60a6a6006 100644 --- a/test/Twilio.Test/TwiML/RoomTest.cs +++ b/test/Twilio.Test/TwiML/RoomTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Room(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SayTest.cs b/test/Twilio.Test/TwiML/SayTest.cs index 80915edf7..78a39be35 100644 --- a/test/Twilio.Test/TwiML/SayTest.cs +++ b/test/Twilio.Test/TwiML/SayTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Say(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SimTest.cs b/test/Twilio.Test/TwiML/SimTest.cs index f2e86d3b0..5db8bade9 100644 --- a/test/Twilio.Test/TwiML/SimTest.cs +++ b/test/Twilio.Test/TwiML/SimTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Sim(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SipTest.cs b/test/Twilio.Test/TwiML/SipTest.cs index 38a150b48..752ab7edd 100644 --- a/test/Twilio.Test/TwiML/SipTest.cs +++ b/test/Twilio.Test/TwiML/SipTest.cs @@ -59,10 +59,11 @@ public void TestElementWithExtraAttributes() var elem = new Sip(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SiprecTest.cs b/test/Twilio.Test/TwiML/SiprecTest.cs index b474e3a6c..a832229e5 100644 --- a/test/Twilio.Test/TwiML/SiprecTest.cs +++ b/test/Twilio.Test/TwiML/SiprecTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Siprec(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SmsTest.cs b/test/Twilio.Test/TwiML/SmsTest.cs index f7934b43c..cb0a2fb3e 100644 --- a/test/Twilio.Test/TwiML/SmsTest.cs +++ b/test/Twilio.Test/TwiML/SmsTest.cs @@ -50,10 +50,11 @@ public void TestElementWithExtraAttributes() var elem = new Sms(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlBreakTest.cs b/test/Twilio.Test/TwiML/SsmlBreakTest.cs index a3848b2d2..1b3836acb 100644 --- a/test/Twilio.Test/TwiML/SsmlBreakTest.cs +++ b/test/Twilio.Test/TwiML/SsmlBreakTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlBreak(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlEmphasisTest.cs b/test/Twilio.Test/TwiML/SsmlEmphasisTest.cs index 177c51d7e..66a6a6ea5 100644 --- a/test/Twilio.Test/TwiML/SsmlEmphasisTest.cs +++ b/test/Twilio.Test/TwiML/SsmlEmphasisTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlEmphasis(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlLangTest.cs b/test/Twilio.Test/TwiML/SsmlLangTest.cs index 30cfd54f5..41f7790cf 100644 --- a/test/Twilio.Test/TwiML/SsmlLangTest.cs +++ b/test/Twilio.Test/TwiML/SsmlLangTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlLang(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlPTest.cs b/test/Twilio.Test/TwiML/SsmlPTest.cs index 81841d8b6..d204a21b0 100644 --- a/test/Twilio.Test/TwiML/SsmlPTest.cs +++ b/test/Twilio.Test/TwiML/SsmlPTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlP(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "

", + "

", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlPhonemeTest.cs b/test/Twilio.Test/TwiML/SsmlPhonemeTest.cs index f1db84c52..56ae26cd6 100644 --- a/test/Twilio.Test/TwiML/SsmlPhonemeTest.cs +++ b/test/Twilio.Test/TwiML/SsmlPhonemeTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlPhoneme(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlProsodyTest.cs b/test/Twilio.Test/TwiML/SsmlProsodyTest.cs index 324ddea7f..1be35b31c 100644 --- a/test/Twilio.Test/TwiML/SsmlProsodyTest.cs +++ b/test/Twilio.Test/TwiML/SsmlProsodyTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlProsody(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlSTest.cs b/test/Twilio.Test/TwiML/SsmlSTest.cs index fe22d57b5..93b3d07c4 100644 --- a/test/Twilio.Test/TwiML/SsmlSTest.cs +++ b/test/Twilio.Test/TwiML/SsmlSTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlS(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlSayAsTest.cs b/test/Twilio.Test/TwiML/SsmlSayAsTest.cs index c53c859ac..d9c2463e9 100644 --- a/test/Twilio.Test/TwiML/SsmlSayAsTest.cs +++ b/test/Twilio.Test/TwiML/SsmlSayAsTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlSayAs(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlSubTest.cs b/test/Twilio.Test/TwiML/SsmlSubTest.cs index 59593bca1..92a2a93c9 100644 --- a/test/Twilio.Test/TwiML/SsmlSubTest.cs +++ b/test/Twilio.Test/TwiML/SsmlSubTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlSub(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/SsmlWTest.cs b/test/Twilio.Test/TwiML/SsmlWTest.cs index 7b680bd44..17d638db1 100644 --- a/test/Twilio.Test/TwiML/SsmlWTest.cs +++ b/test/Twilio.Test/TwiML/SsmlWTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new SsmlW(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/StartTest.cs b/test/Twilio.Test/TwiML/StartTest.cs index 3b5b1d79d..34fbfd023 100644 --- a/test/Twilio.Test/TwiML/StartTest.cs +++ b/test/Twilio.Test/TwiML/StartTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Start(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/StopTest.cs b/test/Twilio.Test/TwiML/StopTest.cs index aab49dd8a..97259d47e 100644 --- a/test/Twilio.Test/TwiML/StopTest.cs +++ b/test/Twilio.Test/TwiML/StopTest.cs @@ -32,10 +32,11 @@ public void TestElementWithExtraAttributes() var elem = new Stop(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/StreamTest.cs b/test/Twilio.Test/TwiML/StreamTest.cs index 9add99695..81136c30f 100644 --- a/test/Twilio.Test/TwiML/StreamTest.cs +++ b/test/Twilio.Test/TwiML/StreamTest.cs @@ -50,10 +50,11 @@ public void TestElementWithExtraAttributes() var elem = new Stream(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/TaskTest.cs b/test/Twilio.Test/TwiML/TaskTest.cs index f9eaa5961..cce712d7e 100644 --- a/test/Twilio.Test/TwiML/TaskTest.cs +++ b/test/Twilio.Test/TwiML/TaskTest.cs @@ -43,10 +43,11 @@ public void TestElementWithExtraAttributes() var elem = new Task(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/VirtualAgentTest.cs b/test/Twilio.Test/TwiML/VirtualAgentTest.cs index 5e4e4ee9e..7c7b8a19c 100644 --- a/test/Twilio.Test/TwiML/VirtualAgentTest.cs +++ b/test/Twilio.Test/TwiML/VirtualAgentTest.cs @@ -49,10 +49,11 @@ public void TestElementWithExtraAttributes() var elem = new VirtualAgent(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } diff --git a/test/Twilio.Test/TwiML/VoiceResponseTest.cs b/test/Twilio.Test/TwiML/VoiceResponseTest.cs index 5f771e1ab..ca0f011e1 100644 --- a/test/Twilio.Test/TwiML/VoiceResponseTest.cs +++ b/test/Twilio.Test/TwiML/VoiceResponseTest.cs @@ -33,10 +33,11 @@ public void TestElementWithExtraAttributes() var elem = new VoiceResponse(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); + elem.SetOption("xml:lang", "en"); Assert.AreEqual( "" + Environment.NewLine + - "", + "", elem.ToString() ); } @@ -100,7 +101,7 @@ public void TestElementWithChildren() ); elem.Gather( - new[] {Gather.InputEnum.Dtmf}, + new[] {Gather.InputEnum.Dtmf}, new Uri("https://example.com"), Twilio.Http.HttpMethod.Get, 1, diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index e023b9ed5..747f9706c 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -2,7 +2,7 @@ Exe Twilio.Tests - net6.0;net451;net35 + net7.0;net451;net35 win7-x86 win7-x86 false