Skip to content

Commit

Permalink
When key is not found when fetching a specific event report, empty li…
Browse files Browse the repository at this point in the history
…st is returned. This is consistent with the empty list that's returned when there are no objects on the chart, and a general report is requested.
  • Loading branch information
mroloux committed Nov 21, 2018
1 parent 1a097e1 commit 2cf075a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
13 changes: 12 additions & 1 deletion SeatsioDotNet.Test/EventReports/EventReportsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ public void ByStatus()
Assert.Equal(2, report["lolzor"].Count());
Assert.Single(report[ObjectStatus.Booked]);
Assert.Equal(31, report[ObjectStatus.Free].Count());
}

[Fact]
public void ByStatusEmptyChart()
{
var chartKey = Client.Charts.Create().Key;
var evnt = Client.Events.Create(chartKey);

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

Assert.Empty(report);
}

[Fact]
Expand All @@ -99,7 +110,7 @@ public void BySpecificNonExistingStatus()

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

Assert.Null(report);
Assert.Empty(report);
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion SeatsioDotNet/EventReports/EventReports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ private IEnumerable<EventReportItem> FetchReport(string reportType, string event
{
return report[filter];
}
return null;

return new List<EventReportItem>();
}
}
}
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>47</Version>
<Version>48</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 2cf075a

Please sign in to comment.