Ejemplo n.º 1
0
        public void GetParticipantsCount_AllParticipants_ReturnsCountOfParticipants()
        {
            // Arrange
            var drawService = new DrawService();

            drawService.AddParticipant("participant_one");
            drawService.AddParticipant("participant_two");
            drawService.AddParticipant("participant_three");

            // Act
            var result = drawService.GetParticipantsCount();

            // Assert
            Assert.Equal(3, result);
        }
Ejemplo n.º 2
0
        public void RemoveAllParticipants_ReturnsNoParticipants()
        {
            // Arrange
            var drawService = new DrawService();

            drawService.AddParticipant("participant_one");
            drawService.AddParticipant("participant_two");
            drawService.AddParticipant("participant_three");

            // Act
            drawService.RemoveAllParticipants();

            // Assert
            Assert.Equal(0, drawService.GetParticipants().Count);
        }
Ejemplo n.º 3
0
        public void Draw_ReturnsWinner()
        {
            // Arrange
            var drawService = new DrawService();

            drawService.AddParticipant("participant_one");
            drawService.AddParticipant("participant_two");
            drawService.AddParticipant("participant_three");

            // Act
            var winner = drawService.Draw();

            // Assert
            Assert.Contains(drawService.GetParticipants(), _ => _.Contains(winner));
        }
Ejemplo n.º 4
0
        public void RemoveParticipant_SingleParticipant_ReturnsParticipantNotRemoved()
        {
            // Arrange
            var drawService = new DrawService();
            var toRemove    = "participant_one";
            var expected    = "participant_two";

            drawService.AddParticipant(toRemove);
            drawService.AddParticipant(expected);

            // Act
            drawService.RemoveParticipant(toRemove);

            // Assert
            Assert.Equal(expected, drawService.GetParticipants()[0]);
        }
Ejemplo n.º 5
0
        public void AddParticipant_SingleParticipant_ReturnsParticipantAdded()
        {
            // Arrange
            var drawService = new DrawService();

            // Act
            var expected = "participant_one";

            drawService.AddParticipant(expected);

            // Assert
            Assert.Equal(expected, drawService.GetParticipants()[0]);
        }