Example #1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            try
            {
                var seatPassesFilter = true;

                if (!String.IsNullOrWhiteSpace(Position))
                {
                    var pos = new StadiumPosition(Seat.SectionName, Seat.RowName, Seat.SeatName);
                    if (!pos.IsMatch(Position))
                    {
                        seatPassesFilter = false;
                    }
                }

                if (_codeValues != null)
                {
                    if (!_codeValues.Any(cv => cv == Seat.EttCode.CodeValue))
                    {
                        seatPassesFilter = false;
                    }
                }

                if (seatPassesFilter)
                {
                    WriteObject(Seat);
                }
            }
            catch (Exception)
            {
            }
        }
Example #2
0
        public void IsMatch_WhenGivenWrongRow_ReturnsFalse()
        {
            // Arrange
            var filter = "BA:12:1";
            var sut    = new StadiumPosition("BA", "12", "34");

            // Act
            var res = sut.IsMatch(filter);

            // Assert
            res.Should().BeFalse("the row is different");
        }
Example #3
0
        public void IsMatch_WhenGivenExactMatch_ReturnsTrue()
        {
            // Arrange
            var filter = "BA:12:34";
            var sut    = new StadiumPosition("BA", "12", "34");

            // Act
            var res = sut.IsMatch(filter);

            // Assert
            res.Should().BeTrue("this is an exact match");
        }
Example #4
0
        public void IsMatch_WhenGivenOnlySeatThatDoesNotMatch_ReturnsFalse()
        {
            // Arrange
            var filter = "::35";
            var sut    = new StadiumPosition("BA", "12", "34");

            // Act
            var res = sut.IsMatch(filter);

            // Assert
            res.Should().BeFalse("we only care about the seat - which is wrong");
        }
Example #5
0
        public void IsMatch_WhenGivenOnlySeatThatMatches_ReturnsTrue()
        {
            // Arrange
            var filter = "::34";
            var sut    = new StadiumPosition("BA", "12", "34");

            // Act
            var res = sut.IsMatch(filter);

            // Assert
            res.Should().BeTrue("we only care about the seat - which is correct");
        }
Example #6
0
 public void Export(IList <BillettServiceSete> seter, string input)
 {
     Console.WriteLine("Rapporterer status på seter som matcher {0}", input);
     foreach (var seat in seter)
     {
         var pos = new StadiumPosition(seat.SectionName, seat.RowName, seat.SeatName);
         if (pos.IsMatch(input))
         {
             Console.WriteLine("{0} {1} ({2})", pos.ToString().PadRight(15), seat.EttCode.Code, SeatStatusClassifier.Classify(seat.EttCode.Code));
         }
     }
 }