diff --git a/Bandwidth.Standard/Voice/Bxml/Ring.cs b/Bandwidth.Standard/Voice/Bxml/Ring.cs index 5baa16ec..24cda11c 100644 --- a/Bandwidth.Standard/Voice/Bxml/Ring.cs +++ b/Bandwidth.Standard/Voice/Bxml/Ring.cs @@ -14,12 +14,19 @@ public class Ring : IVerb [XmlAttribute("duration")] public double Duration { get; set; } + /// + /// (optional) A boolean indicating whether or not to answer the call when Ring is executed on an unanswered incoming call. Default value is 'true'. + /// + [XmlAttribute("answerCall")] + public bool AnswerCall { get; set; } + /// /// Initialize the double fields to Bandwidth's default value /// public Ring() { Duration = 5; + AnswerCall = true; } } } diff --git a/Bandwidth.StandardTests/Voice/Bxml/RingTests.cs b/Bandwidth.StandardTests/Voice/Bxml/RingTests.cs new file mode 100644 index 00000000..ba6cefb7 --- /dev/null +++ b/Bandwidth.StandardTests/Voice/Bxml/RingTests.cs @@ -0,0 +1,66 @@ +using Bandwidth.Standard.Voice.Bxml; +using Xunit; + +namespace Bandwidth.StandardTests.Voice.Bxml +{ + public class RingTests + { + [Fact] + public void RingShouldBeDefaults() + { + var ring = new Ring(); + + Assert.Equal(5, ring.Duration); + Assert.True(ring.AnswerCall); + } + + [Fact] + public void RingDurationShouldBeTen() + { + var ring = new Ring(); + ring.Duration = 10; + + Assert.Equal(10, ring.Duration); + } + + [Fact] + public void RingAnswerCallShouldBeFalse() + { + var ring = new Ring(); + ring.AnswerCall = false; + + Assert.False(ring.AnswerCall); + } + + [Fact] + public void RingResponseToBXMLShouldBeDefaults() + { + var ring = new Ring(); + var response = new Response(ring); + + Assert.Equal(" ", response.ToBXML()); + } + + [Fact] + public void RingDurationResponseToBXMLShouldBeThirty() + { + var ring = new Ring(); + ring.Duration = 30; + + var response = new Response(ring); + + Assert.Equal(" ", response.ToBXML()); + } + + [Fact] + public void RingAnswerCallResponseToBXMLShouldBeFalse() + { + var ring = new Ring(); + ring.AnswerCall = false; + + var response = new Response(ring); + + Assert.Equal(" ", response.ToBXML()); + } + } +} \ No newline at end of file