Exemple #1
0
        public void AddActivity_Succeeds()
        {
            ActivityDTO activityDTO = new ActivityDTO()
            {
                ActivityType = ActivityType.ATELIER,
                Name         = "Zwemmen",
                Description  = "Samen met de vriendengroep gaan zwemmen in het stedelijk zwembad",
                Pictogram    = null
            };

            ActionResult <Activity> actionResult = _controller.Add(activityDTO);
            var      response    = actionResult.Result as OkObjectResult;
            Activity newActivity = response?.Value as Activity;

            Assert.Equal(200, response?.StatusCode);
            Assert.Equal("Zwemmen", newActivity.Name);

            _activityRepository.Verify(a => a.Add(It.IsAny <Activity>()), Times.Once());
            _activityRepository.Verify(a => a.SaveChanges(), Times.Once());
        }