From 3e2c63be24869b945daf45d49436d514968f42db Mon Sep 17 00:00:00 2001 From: mroloux Date: Thu, 24 Feb 2022 10:48:26 +0100 Subject: [PATCH] Extra season properties on events (#48) * Expose more season data on events * Fixed build * Version bump --- SeatsioDotNet.Test/Events/RetrieveEventTest.cs | 3 +++ SeatsioDotNet.Test/ExponentialBackoffTest.cs | 2 +- SeatsioDotNet.Test/Seasons/CreateEventsInSeasonTest.cs | 2 ++ SeatsioDotNet.Test/Seasons/CreatePartialSeasonTest.cs | 2 ++ SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs | 2 ++ SeatsioDotNet/Events/Event.cs | 4 ++++ SeatsioDotNet/SeatsioDotNet.csproj | 2 +- 7 files changed, 15 insertions(+), 2 deletions(-) diff --git a/SeatsioDotNet.Test/Events/RetrieveEventTest.cs b/SeatsioDotNet.Test/Events/RetrieveEventTest.cs index c9f2dc2..1811915 100644 --- a/SeatsioDotNet.Test/Events/RetrieveEventTest.cs +++ b/SeatsioDotNet.Test/Events/RetrieveEventTest.cs @@ -17,6 +17,7 @@ public void Test() Assert.NotNull(retrievedEvent.Key); Assert.NotEqual(0, retrievedEvent.Id); + Assert.False(retrievedEvent.IsEventInSeason); Assert.Equal(chartKey, retrievedEvent.ChartKey); Assert.Equal("INHERIT", evnt.TableBookingConfig.Mode); Assert.True(retrievedEvent.SupportsBestAvailable); @@ -38,6 +39,8 @@ public void RetrieveSeason() Assert.NotNull(retrievedSeason.Key); Assert.NotEqual(0, retrievedSeason.Id); + Assert.True(retrievedSeason.IsTopLevelSeason); + Assert.Null(retrievedSeason.TopLevelSeasonKey); Assert.Equal(new[] {partialSeason1.Key, partialSeason2.Key}, retrievedSeason.PartialSeasonKeys); Assert.Empty(retrievedSeason.Events); Assert.Equal(chartKey, season.ChartKey); diff --git a/SeatsioDotNet.Test/ExponentialBackoffTest.cs b/SeatsioDotNet.Test/ExponentialBackoffTest.cs index 2129364..61285dc 100644 --- a/SeatsioDotNet.Test/ExponentialBackoffTest.cs +++ b/SeatsioDotNet.Test/ExponentialBackoffTest.cs @@ -18,7 +18,7 @@ public void AbortsEventuallyIfServerKeepsReturning429() var duration = DateTimeOffset.Now.ToUnixTimeSeconds() - start.ToUnixTimeSeconds(); Assert.True(duration > 10); - Assert.True(duration < 20); + Assert.True(duration < 30); } [Fact] diff --git a/SeatsioDotNet.Test/Seasons/CreateEventsInSeasonTest.cs b/SeatsioDotNet.Test/Seasons/CreateEventsInSeasonTest.cs index efa99fd..c4cdcb2 100644 --- a/SeatsioDotNet.Test/Seasons/CreateEventsInSeasonTest.cs +++ b/SeatsioDotNet.Test/Seasons/CreateEventsInSeasonTest.cs @@ -14,6 +14,8 @@ public void EventsKeysCanBePassedIn() var updatedSeason = Client.Seasons.CreateEvents(season.Key, eventKeys: new[] {"event1", "event2"}); Assert.Equal(new[] {"event1", "event2"}, updatedSeason.Events.Select(e => e.Key)); + Assert.True(updatedSeason.Events[0].IsEventInSeason); + Assert.Equal(season.Key, updatedSeason.Events[0].TopLevelSeasonKey); } [Fact] diff --git a/SeatsioDotNet.Test/Seasons/CreatePartialSeasonTest.cs b/SeatsioDotNet.Test/Seasons/CreatePartialSeasonTest.cs index 9ec1077..ef5c9b9 100644 --- a/SeatsioDotNet.Test/Seasons/CreatePartialSeasonTest.cs +++ b/SeatsioDotNet.Test/Seasons/CreatePartialSeasonTest.cs @@ -14,6 +14,8 @@ public void KeyCanBePassedIn() var partialSeason = Client.Seasons.CreatePartialSeason(topLevelSeason.Key, partialSeasonKey: "aPartialSeason"); Assert.Equal("aPartialSeason", partialSeason.Key); + Assert.True(partialSeason.IsPartialSeason); + Assert.Equal(topLevelSeason.Key, partialSeason.TopLevelSeasonKey); } [Fact] diff --git a/SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs b/SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs index 5750a96..8fab514 100644 --- a/SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs +++ b/SeatsioDotNet.Test/Seasons/CreateSeasonTest.cs @@ -18,6 +18,8 @@ public void ChartKeyIsMandatory() Assert.NotNull(season.Key); Assert.NotEqual(0, season.Id); + Assert.True(season.IsTopLevelSeason); + Assert.Null(season.TopLevelSeasonKey); Assert.Empty(season.PartialSeasonKeys); Assert.Empty(season.Events); Assert.Equal(chartKey, season.ChartKey); diff --git a/SeatsioDotNet/Events/Event.cs b/SeatsioDotNet/Events/Event.cs index 1159357..18041d8 100644 --- a/SeatsioDotNet/Events/Event.cs +++ b/SeatsioDotNet/Events/Event.cs @@ -18,5 +18,9 @@ public class Event public List PartialSeasonKeys { get; set; } public List Events { get; set; } public bool IsSeason { get; set; } + public bool IsTopLevelSeason { get; set; } + public bool IsPartialSeason { get; set; } + public bool IsEventInSeason { get; set; } + public string TopLevelSeasonKey { get; set; } } } \ No newline at end of file diff --git a/SeatsioDotNet/SeatsioDotNet.csproj b/SeatsioDotNet/SeatsioDotNet.csproj index f5893ea..9f45119 100644 --- a/SeatsioDotNet/SeatsioDotNet.csproj +++ b/SeatsioDotNet/SeatsioDotNet.csproj @@ -2,7 +2,7 @@ Library true - 85.0.0 + 85.1.0 mroloux;bverbeken Official Seats.io .NET API client Official Seats.io .NET API client