Esempio n. 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)
            {
            }
        }
Esempio n. 2
0
        public void ToString_WhenCalled_ProducesExpectedOutput()
        {
            // Arrange
            var sut = new StadiumPosition("BA", "12", "34");

            // Act
            var res = sut.ToString();

            // Assert
            res.Should().Be("BA:12:34", "those are the 'coordinates' of the seat");
        }
Esempio n. 3
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");
        }
Esempio n. 4
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");
        }
Esempio n. 5
0
        public void Constructor_WhenGivenNoRowName_StillFunctionsProperly()
        {
            // Arrange

            // Act
            var sut = new StadiumPosition("KJ", String.Empty, "1100");

            // Assert
            sut.SectionName.Should().Be("KJ", "that is the section name given");
            sut.RowName.Should().Be(String.Empty, "that is the row name given");
            sut.SeatName.Should().Be("1100", "that is the seat name given");
        }
Esempio n. 6
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");
        }
Esempio n. 7
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");
        }
Esempio n. 8
0
        public void Constructor_WhenGivenSaneProperties_SetsTheCorrectProperties()
        {
            // Arrange

            // Act
            var sut = new StadiumPosition("SEC", "ROW", "SEAT");

            // Assert
            sut.SectionName.Should().Be("SEC", "that is the section name given");
            sut.RowName.Should().Be("ROW", "that is the row name given");
            sut.SeatName.Should().Be("SEAT", "that is the seat name given");
        }
Esempio n. 9
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));
         }
     }
 }