From 2cf075a5fcbbd196f462b72e60eb3c7b244662d4 Mon Sep 17 00:00:00 2001 From: mroloux Date: Wed, 21 Nov 2018 09:14:50 +0100 Subject: [PATCH] When key is not found when fetching a specific event report, empty list 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. --- SeatsioDotNet.Test/EventReports/EventReportsTest.cs | 13 ++++++++++++- SeatsioDotNet/EventReports/EventReports.cs | 3 ++- SeatsioDotNet/SeatsioDotNet.csproj | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/SeatsioDotNet.Test/EventReports/EventReportsTest.cs b/SeatsioDotNet.Test/EventReports/EventReportsTest.cs index f4abb65..b40b43b 100644 --- a/SeatsioDotNet.Test/EventReports/EventReportsTest.cs +++ b/SeatsioDotNet.Test/EventReports/EventReportsTest.cs @@ -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] @@ -99,7 +110,7 @@ public void BySpecificNonExistingStatus() var report = Client.EventReports.ByStatus(evnt.Key, "lolzor"); - Assert.Null(report); + Assert.Empty(report); } [Fact] diff --git a/SeatsioDotNet/EventReports/EventReports.cs b/SeatsioDotNet/EventReports/EventReports.cs index e50bbdd..99753b2 100644 --- a/SeatsioDotNet/EventReports/EventReports.cs +++ b/SeatsioDotNet/EventReports/EventReports.cs @@ -120,7 +120,8 @@ private IEnumerable FetchReport(string reportType, string event { return report[filter]; } - return null; + + return new List(); } } } \ No newline at end of file diff --git a/SeatsioDotNet/SeatsioDotNet.csproj b/SeatsioDotNet/SeatsioDotNet.csproj index 8e246ca..876113c 100644 --- a/SeatsioDotNet/SeatsioDotNet.csproj +++ b/SeatsioDotNet/SeatsioDotNet.csproj @@ -2,7 +2,7 @@ Library true - 47 + 48 mroloux;bverbeken Official Seats.io .NET API client Official Seats.io .NET API client