Skip to content

Commit

Permalink
When key is not found when fetching a specific event report, None is …
Browse files Browse the repository at this point in the history
…returned to be consistent with the server-side API
  • Loading branch information
mroloux committed Nov 20, 2018
1 parent dd39a23 commit 1a097e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
11 changes: 11 additions & 0 deletions SeatsioDotNet.Test/EventReports/EventReportsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ public void BySpecificStatus()
var report = Client.EventReports.ByStatus(evnt.Key, "lolzor");

Assert.Equal(2, report.Count());
}

[Fact]
public void BySpecificNonExistingStatus()
{
var chartKey = CreateTestChart();
var evnt = Client.Events.Create(chartKey);

var report = Client.EventReports.ByStatus(evnt.Key, "lolzor");

Assert.Null(report);
}

[Fact]
Expand Down
6 changes: 5 additions & 1 deletion SeatsioDotNet/EventReports/EventReports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ private IEnumerable<EventReportItem> FetchReport(string reportType, string event
.AddUrlSegment("reportType", reportType)
.AddUrlSegment("filter", filter);
var report = AssertOk(_restClient.Execute<Dictionary<string, IEnumerable<EventReportItem>>>(restRequest));
return report[filter];
if (report.ContainsKey(filter))
{
return report[filter];
}
return null;
}
}
}
2 changes: 1 addition & 1 deletion SeatsioDotNet/SeatsioDotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<IsPackable>true</IsPackable>
<Version>46</Version>
<Version>47</Version>
<Authors>mroloux;bverbeken</Authors>
<Title>Official Seats.io .NET API client</Title>
<Description>Official Seats.io .NET API client</Description>
Expand Down

0 comments on commit 1a097e1

Please sign in to comment.