Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added record attribute on Conference Verb and related tests

  • Loading branch information...
commit e6ff91032a0c1a047bf7fdc567e4675ed42cca21 1 parent 7070f77
Jacob Gable authored
51 TwilioSharp.Test/TwiMLBuilderTest.cs
View
@@ -22,13 +22,13 @@ private class TestNode
public Dictionary<string, string> Attributes { get; set; }
public List<TestNode> Children { get; set; }
- public static TestNode Create(string name, string value = "", Dictionary<string, string> dictionary = null, params TestNode[] children)
+ public static TestNode Create(string name, string value = "", Dictionary<string, string> attributes = null, params TestNode[] children)
{
return new TestNode()
{
Name = name,
Value = value,
- Attributes = dictionary ?? new Dictionary<string, string>(),
+ Attributes = attributes ?? new Dictionary<string, string>(),
Children = children.ToList()
};
}
@@ -116,6 +116,53 @@ public void Dial_Conference()
}
[TestMethod]
+ public void Dial_Conference_Should_Have_Record_Attribute_When_Passed_In_True()
+ {
+ var response = TwiMLBuilder
+ .Build()
+ .DialConference("930-Standup", record: true)
+ .ToXmlResponse();
+
+ CommonXMLAssert(response,
+ TestNode.Create("Dial", string.Empty, null,
+ TestNode.Create("Conference", "930-Standup", new Dictionary<string, string>
+ {
+ { "record", "true"}
+ })));
+ }
+
+ [TestMethod]
+ public void Dial_Conference_Should_Have_Record_Attribute_When_Passed_In_False()
+ {
+ var response = TwiMLBuilder
+ .Build()
+ .DialConference("930-Standup", record: false)
+ .ToXmlResponse();
+
+ CommonXMLAssert(response,
+ TestNode.Create("Dial", string.Empty, null,
+ TestNode.Create("Conference", "930-Standup", new Dictionary<string, string>
+ {
+ { "record", "false"}
+ })));
+ }
+
+ [TestMethod]
+ public void Dial_Conference_Should_NOT_Have_Record_Attribute_When_Not_Passed_In()
+ {
+ var response = TwiMLBuilder
+ .Build()
+ .DialConference("930-Standup")
+ .ToXmlResponse();
+
+ var confNode = response.Descendants("Conference").FirstOrDefault();
+ Assert.IsNotNull(confNode);
+
+ var hasRecordAttribute = confNode.Attributes().Any(x => x.Name == "record");
+ Assert.IsFalse(hasRecordAttribute);
+ }
+
+ [TestMethod]
public void Hangup()
{
var response = TwiMLBuilder
6 TwilioSharp/TwiML/Builder.cs
View
@@ -274,11 +274,12 @@ public TwiMLBuilder Play(string fileUrl, uint timesToLoop = 1)
/// <param name="timeLimitMilliseconds">The time limit milliseconds.</param>
/// <param name="statusCallbackUrl">The status callback URL.</param>
/// <param name="callerIdNumber">The caller id number.</param>
+ /// <param name="record">UNDOCUMENTED: Whether to record this conference or not.</param>
public TwiMLBuilder DialConference(string conferenceName, bool participantMuted = false, bool beepOnEnterOrExit = true, bool startConferenceOnEnter = true, bool endConferenceOnExit = false,
string waitMusicUrl = "", ActionMethod waitMusicMethod = ActionMethod.POST, uint maxParticipants = 40,
string actionUrl = "", ActionMethod methodUrl = ActionMethod.POST, uint timeoutSeconds = 30,
bool hangupOnStar = false, uint timeLimitMilliseconds = 14400,
- string statusCallbackUrl = "", string callerIdNumber = "")
+ string statusCallbackUrl = "", string callerIdNumber = "", bool? record = null)
{
return AddVerb(Verb.Dial,
string.Empty,
@@ -300,7 +301,8 @@ public TwiMLBuilder Play(string fileUrl, uint timesToLoop = 1)
startConferenceOnEnter = startConferenceOnEnter,
endConferenceOnExit = endConferenceOnExit,
waitUrl = waitMusicUrl,
- waitMethod = waitMusicMethod
+ waitMethod = waitMusicMethod,
+ record = record
})
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.