Exemple #1
0
        public void IgnoreSocialDistancing()
        {
            var chartKey = CreateTestChart();
            var ruleset  = SocialDistancingRuleset.Fixed("ruleset")
                           .WithDisabledSeats(new List <string> {
                "A-1"
            })
                           .Build();
            var rulesets = new Dictionary <string, SocialDistancingRuleset>
            {
                { "ruleset", ruleset },
            };

            Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets);
            var evnt = Client.Events.Create(chartKey, null, null, "ruleset");

            Client.Events.ChangeObjectStatus(evnt.Key, new[] { "A-1" }, "someStatus", null, null, null, null, null, true);

            Assert.Null(Client.Events.RetrieveObjectInfo(evnt.Key, "A-1").ExtraData);
        }
Exemple #2
0
        public void IgnoreSocialDistancing()
        {
            var chartKey = CreateTestChart();
            var ruleset  = SocialDistancingRuleset.Fixed("ruleset")
                           .WithDisabledSeats(new List <string> {
                "A-1"
            })
                           .Build();
            var rulesets = new Dictionary <string, SocialDistancingRuleset>
            {
                { "ruleset", ruleset },
            };

            Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets);
            var event1 = Client.Events.Create(chartKey, null, null, "ruleset");
            var event2 = Client.Events.Create(chartKey, null, null, "ruleset");

            Client.Events.Book(new[] { event1.Key, event2.Key }, new[] { "A-1" }, null, null, null, null, null, true);

            Assert.Equal(EventObjectInfo.Booked, Client.Events.RetrieveObjectInfo(event1.Key, "A-1").Status);
            Assert.Equal(EventObjectInfo.Booked, Client.Events.RetrieveObjectInfo(event2.Key, "A-1").Status);
        }
Exemple #3
0
        public void IgnoreSocialDistancing()
        {
            var chartKey = CreateTestChart();
            var evnt     = Client.Events.Create(chartKey);
            var ruleset  = SocialDistancingRuleset.Fixed("ruleset")
                           .WithDisabledSeats(new List <string> {
                "A-1"
            })
                           .Build();

            var rulesets = new Dictionary <string, SocialDistancingRuleset>
            {
                { "ruleset", ruleset },
            };

            Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets);
            Client.Events.Update(evnt.Key, null, null, null, "ruleset");
            HoldToken holdToken = Client.HoldTokens.Create();

            Client.Events.Hold(evnt.Key, new[] { "A-1" }, holdToken.Token, null, null, null, null, true);

            Assert.Equal(EventObjectInfo.Held, Client.Events.RetrieveObjectInfo(evnt.Key, "A-1").Status);
        }
Exemple #4
0
        public void SaveRulesets()
        {
            var chartKey = CreateTestChart();
            var ruleset1 = SocialDistancingRuleset.RuleBased("My first ruleset")
                           .WithIndex(0)
                           .WithNumberOfDisabledSeatsToTheSides(1)
                           .WithDisableSeatsInFrontAndBehind(true)
                           .WithDisableDiagonalSeatsInFrontAndBehind(true)
                           .WithNumberOfDisabledAisleSeats(2)
                           .WithMaxGroupSize(1)
                           .WithMaxOccupancyAbsolute(10)
                           .WithOneGroupPerTable(true)
                           .WithDisabledSeats(new List <string> {
                "A-1"
            })
                           .WithEnabledSeats(new List <string> {
                "A-2"
            })
                           .Build();

            var ruleset2 = SocialDistancingRuleset.Fixed("My second ruleset")
                           .WithIndex(1)
                           .WithDisabledSeats(new List <string> {
                "A-1"
            })
                           .Build();

            var rulesets = new Dictionary <string, SocialDistancingRuleset>
            {
                { "ruleset1", ruleset1 },
                { "ruleset2", ruleset2 }
            };

            Client.Charts.SaveSocialDistancingRulesets(chartKey, rulesets);

            var retrievedChart = Client.Charts.Retrieve(chartKey);

            Assert.Equal(2, retrievedChart.SocialDistancingRulesets.Count);

            var retrievedRuleset1 = retrievedChart.SocialDistancingRulesets["ruleset1"];

            Assert.Equal(0, retrievedRuleset1.Index);
            Assert.Equal("My first ruleset", retrievedRuleset1.Name);
            Assert.Equal(1, retrievedRuleset1.NumberOfDisabledSeatsToTheSides);
            Assert.True(retrievedRuleset1.DisableSeatsInFrontAndBehind);
            Assert.True(retrievedRuleset1.DisableDiagonalSeatsInFrontAndBehind);
            Assert.Equal(2, retrievedRuleset1.NumberOfDisabledAisleSeats);
            Assert.Equal(1, retrievedRuleset1.MaxGroupSize);
            Assert.Equal(10, retrievedRuleset1.MaxOccupancyAbsolute);
            Assert.Equal(0, retrievedRuleset1.MaxOccupancyPercentage);
            Assert.True(retrievedRuleset1.OneGroupPerTable);
            Assert.False(retrievedRuleset1.FixedGroupLayout);
            Assert.Equal(new List <string> {
                "A-1"
            }, retrievedRuleset1.DisabledSeats);
            Assert.Equal(new List <string> {
                "A-2"
            }, retrievedRuleset1.EnabledSeats);

            var retrievedRuleset2 = retrievedChart.SocialDistancingRulesets["ruleset2"];

            Assert.Equal(1, retrievedRuleset2.Index);
            Assert.Equal("My second ruleset", retrievedRuleset2.Name);
            Assert.Equal(0, retrievedRuleset2.NumberOfDisabledSeatsToTheSides);
            Assert.False(retrievedRuleset2.DisableSeatsInFrontAndBehind);
            Assert.False(retrievedRuleset2.DisableDiagonalSeatsInFrontAndBehind);
            Assert.Equal(0, retrievedRuleset2.NumberOfDisabledAisleSeats);
            Assert.Equal(0, retrievedRuleset2.MaxGroupSize);
            Assert.Equal(0, retrievedRuleset2.MaxOccupancyAbsolute);
            Assert.Equal(0, retrievedRuleset2.MaxOccupancyPercentage);
            Assert.False(retrievedRuleset2.OneGroupPerTable);
            Assert.True(retrievedRuleset2.FixedGroupLayout);
            Assert.Equal(new List <string> {
                "A-1"
            }, retrievedRuleset1.DisabledSeats);
            Assert.Empty(retrievedRuleset2.EnabledSeats);
        }