Ejemplo n.º 1
0
        public void RemoveActivity_Succeeds()
        {
            int activityId = 1;

            _activityRepository.Setup(a => a.GetById(activityId)).Returns(_dummyDBContext.Activity1);

            ActionResult <Activity> actionResult   = _controller.Remove(activityId);
            OkObjectResult          okObjectResult = actionResult.Result as OkObjectResult;
            Activity activity = okObjectResult.Value as Activity;

            Assert.Equal("Testatelier", activity.Name);
            Assert.NotNull(activity);
            _activityRepository.Verify(a => a.Remove(It.IsAny <Activity>()), Times.Once());
            _activityRepository.Verify(a => a.SaveChanges(), Times.Once());
        }