示例#1
0
        public ParticipantModel(Participant entity)
        {
            ParticipantId = entity.ParticipantId;

            Name = entity.Name;
            Contact = entity.Contact;
        }
示例#2
0
        public void PriorityQueue_ExtractMax_InsertHighestBubblesToRoot()
        {
            #region Arrange
            Participant participantHighest = new Participant() { Name = "Highest", ParticipantId = 1 };
            Participant participantMiddle = new Participant() { Name = "Middle", ParticipantId = 2 };
            Participant participantLower = new Participant() { Name = "Lower", ParticipantId = 3 };
            Participant participantLowest = new Participant() { Name = "Lowest", ParticipantId = 4 };
            int highestRoll = 100;
            int middleRoll = 50;
            int lowerRoll = 10;
            int lowestRoll = 1;

            PriorityQueue<Participant, int> WinnersMiddleLowestHighest = new PriorityQueue<Participant, int>(new ExtractMax());
            WinnersMiddleLowestHighest.Insert(participantMiddle, middleRoll);
            WinnersMiddleLowestHighest.Insert(participantLower, lowerRoll);
            WinnersMiddleLowestHighest.Insert(participantHighest, highestRoll);
            WinnersMiddleLowestHighest.Insert(participantLowest, lowestRoll);
            #endregion

            #region Act
            var highestWinner = WinnersMiddleLowestHighest.ExtractKey();
            #endregion

            #region Assert
            Assert.AreEqual(participantHighest, highestWinner, "Highest Participant Not Extracted Correctly.");
            #endregion
        }