Ejemplo n.º 1
0
        public void CanGetListOfParticipants()
        {
            Mock <IParticipantRepository> repo = new Mock <IParticipantRepository>();

            repo.Setup(x => x.GetListOfParticipants()).Returns(
                new List <Participant>()
            {
                new Participant(Guid.NewGuid(), "Person A"),
                new Participant(Guid.NewGuid(), "Person B")
            }
                );

            var controller = new ParticipantController(repo.Object);

            var result = controller.GetListOfParticipants();

            //we'll map this to a HTTPGet of \Participant\

            Assert.NotNull(result);
            Assert.NotEmpty(result);
            Assert.Equal(2, result.Count());
            Assert.Equal("Person A", result.First().Name);
        }