Skip to content

Commit 878a78a

Browse files
authored
Merge pull request #61 from Bandwidth/DX-2967
DX-2967 Fix Bug in `BandwidthCallbackMessage` Model
2 parents 852b1b2 + 20bf86c commit 878a78a

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

Bandwidth.Standard/Messaging/Models/BandwidthCallbackMessage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public BandwidthCallbackMessage(
4040
string time = null,
4141
string type = null,
4242
string to = null,
43-
string errorCode = null,
43+
int? errorCode = null,
4444
string description = null,
4545
Models.BandwidthMessage message = null)
4646
{
@@ -74,7 +74,7 @@ public BandwidthCallbackMessage(
7474
/// Gets or sets ErrorCode.
7575
/// </summary>
7676
[JsonProperty("errorCode", NullValueHandling = NullValueHandling.Ignore)]
77-
public string ErrorCode { get; set; }
77+
public int? ErrorCode { get; set; }
7878

7979
/// <summary>
8080
/// Gets or sets Description.
@@ -167,9 +167,9 @@ protected void ToString(List<string> toStringOutput)
167167
toStringOutput.Add($"this.Time = {(this.Time == null ? "null" : this.Time == string.Empty ? "" : this.Time)}");
168168
toStringOutput.Add($"this.Type = {(this.Type == null ? "null" : this.Type == string.Empty ? "" : this.Type)}");
169169
toStringOutput.Add($"this.To = {(this.To == null ? "null" : this.To == string.Empty ? "" : this.To)}");
170-
toStringOutput.Add($"this.ErrorCode = {(this.ErrorCode == null ? "null" : this.ErrorCode == string.Empty ? "" : this.ErrorCode)}");
170+
toStringOutput.Add($"this.ErrorCode = {(this.ErrorCode == null ? "null" : this.ErrorCode.ToString())}");
171171
toStringOutput.Add($"this.Description = {(this.Description == null ? "null" : this.Description == string.Empty ? "" : this.Description)}");
172172
toStringOutput.Add($"this.Message = {(this.Message == null ? "null" : this.Message.ToString())}");
173173
}
174174
}
175-
}
175+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Bandwidth.Standard.Messaging.Models;
2+
using Xunit;
3+
4+
namespace Bandwidth.StandardTests.Messaging
5+
{
6+
public class BandwidthCallbackMessageTests
7+
{
8+
[Fact]
9+
public void InitializeMessagingCallbackModel()
10+
{
11+
BandwidthMessage testMessage = new BandwidthMessage();
12+
13+
BandwidthCallbackMessage testCallback = new BandwidthCallbackMessage(
14+
time: "2016-09-14T18:20:16Z",
15+
type: "message-failed",
16+
to: "+52345678903",
17+
errorCode: 4432,
18+
description: "forbidden to country",
19+
message: testMessage
20+
);
21+
22+
Assert.Equal("BandwidthCallbackMessage : (this.Time = 2016-09-14T18:20:16Z, this.Type = message-failed, this.To = +52345678903, this.ErrorCode = 4432, this.Description = forbidden to country, this.Message = BandwidthMessage : (this.Id = null, this.Owner = null, this.ApplicationId = null, this.Time = null, this.SegmentCount = null, this.Direction = null, this.To = null, this.From = null, this.Media = null, this.Text = null, this.Tag = null, this.Priority = null))", testCallback.ToString());
23+
Assert.IsType<int>(testCallback.ErrorCode);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)