public void AddAttributeThatWasAlreadyThereShouldDoNothing()
        {
            //Arrange
            var s = new SeatInfo {
                SeatAttributes = new[] { SeatAttributeEnum.Dealer }
            };

            //Act
            s.AddAttribute(SeatAttributeEnum.Dealer);

            //Assert
            Assert.AreEqual(1, s.SeatAttributes.Length);
            Assert.IsTrue(s.HasAttribute(SeatAttributeEnum.Dealer));
        }
        public void AddAttributeThatWasNotThereShouldAdd()
        {
            //Arrange
            var s = new SeatInfo {
                SeatAttributes = new[] { SeatAttributeEnum.Dealer }
            };

            //Act
            s.AddAttribute(SeatAttributeEnum.FirstTalker);

            //Assert
            Assert.AreEqual(2, s.SeatAttributes.Length);
            Assert.IsTrue(s.HasAttribute(SeatAttributeEnum.Dealer));
            Assert.IsTrue(s.HasAttribute(SeatAttributeEnum.FirstTalker));
        }
Exemple #3
0
 /// <summary>
 /// Takes away the attribute from the seats having it, and gives it to the new one who needs it
 /// </summary>
 /// <param name="seats">Seat collection</param>
 /// <param name="receiver">Seat that needs the attribute</param>
 /// <param name="att">The attribute</param>
 public static void MoveAttributeTo(this IEnumerable <SeatInfo> seats, SeatInfo receiver, SeatAttributeEnum att)
 {
     seats.ClearAttribute(att);
     receiver?.AddAttribute(att);
 }