Skip to content

Commit

Permalink
tableBookingModes can be passed in when creating or updating an event
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Oct 24, 2018
1 parent 0c49193 commit dd39a23
Show file tree
Hide file tree
Showing 11 changed files with 1,769 additions and 23 deletions.
6 changes: 1 addition & 5 deletions SeatsioDotNet.Test/Events/ChangeObjectStatusTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,11 @@ public void Quantity()
var chartKey = CreateTestChart();
var evnt = Client.Events.Create(chartKey);
ObjectProperties object1 = new ObjectProperties("GA1", 5);
ObjectProperties object2 = new ObjectProperties("GA2", 10);

Client.Events.ChangeObjectStatus(evnt.Key, new[] {object1, object2}, "foo");
Client.Events.ChangeObjectStatus(evnt.Key, new[] {object1}, "foo");

var status1 = Client.Events.RetrieveObjectStatus(evnt.Key, "GA1");
Assert.Equal(5, status1.Quantity);

var status2 = Client.Events.RetrieveObjectStatus(evnt.Key, "GA2");
Assert.Equal(10, status2.Quantity);
}

[Fact]
Expand Down
16 changes: 15 additions & 1 deletion SeatsioDotNet.Test/Events/CreateEventTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Xunit;

namespace SeatsioDotNet.Test.Events
Expand Down Expand Up @@ -27,7 +28,7 @@ public void EventKeyIsOptional()
{
var chartKey = CreateTestChart();

var evnt = Client.Events.Create(chartKey, "eventje", null);
var evnt = Client.Events.Create(chartKey, "eventje");

Assert.Equal("eventje", evnt.Key);
Assert.False(evnt.BookWholeTables);
Expand All @@ -42,6 +43,19 @@ public void BookWholeTablesIsOptional()

Assert.NotNull(evnt.Key);
Assert.True(evnt.BookWholeTables);
}

[Fact]
public void TableBookingModesAreOptional()
{
var chartKey = CreateTestChartWithTables();
var tableBookingModes = new Dictionary<string, string> {{"T1", "BY_TABLE"}, {"T2", "BY_SEAT"}};

var evnt = Client.Events.Create(chartKey, null, tableBookingModes);

Assert.NotNull(evnt.Key);
Assert.False(evnt.BookWholeTables);
Assert.Equal(evnt.TableBookingModes, tableBookingModes);
}
}
}
20 changes: 18 additions & 2 deletions SeatsioDotNet.Test/Events/UpdateEventTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Xunit;

namespace SeatsioDotNet.Test.Events
Expand All @@ -12,7 +13,7 @@ public void UpdateChartKey()
var chartKey2 = CreateTestChart();
var evnt = Client.Events.Create(chartKey1);

Client.Events.Update(evnt.Key, chartKey2, null, null);
Client.Events.Update(evnt.Key, chartKey2, null);

var retrievedEvent = Client.Events.Retrieve(evnt.Key);
Assert.Equal(evnt.Key, retrievedEvent.Key);
Expand All @@ -27,7 +28,7 @@ public void UpdateEventKey()
var chartKey = CreateTestChart();
var evnt = Client.Events.Create(chartKey);

Client.Events.Update(evnt.Key, null, "newKey", null);
Client.Events.Update(evnt.Key, null, "newKey");

var retrievedEvent = Client.Events.Retrieve("newKey");
Assert.Equal("newKey", retrievedEvent.Key);
Expand All @@ -47,6 +48,21 @@ public void UpdateBookWholeTables()
Assert.Equal(evnt.Key, retrievedEvent.Key);
Assert.Equal(chartKey, retrievedEvent.ChartKey);
Assert.True(retrievedEvent.BookWholeTables);
}

[Fact]
public void UpdateTableBookingModes()
{
var chartKey = CreateTestChartWithTables();
var evnt = Client.Events.Create(chartKey, null, new Dictionary<string, string> {{"T1", "BY_TABLE"}});

Client.Events.Update(evnt.Key, null, null, new Dictionary<string, string> {{"T1", "BY_SEAT"}});

var retrievedEvent = Client.Events.Retrieve(evnt.Key);
Assert.Equal(evnt.Key, retrievedEvent.Key);
Assert.Equal(chartKey, retrievedEvent.ChartKey);
Assert.False(retrievedEvent.BookWholeTables);
Assert.Equal(retrievedEvent.TableBookingModes, new Dictionary<string, string> {{"T1", "BY_SEAT"}});
}
}
}
20 changes: 8 additions & 12 deletions SeatsioDotNet.Test/SeatsioClientTest.cs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions SeatsioDotNet.Test/SeatsioDotNet.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
<PackageReference Include="RestSharp" Version="106.2.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<Content Include="resources\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Loading

0 comments on commit dd39a23

Please sign in to comment.