public IActionResult Delete(Guid id)
 {
     if (ModelState.IsValid)
     {
         _userNotificationService.Delete(id);
         return(Ok());
     }
     return(BadRequest(ModelState));
 }
        public void Can_Delete()
        {
            //Arrange
            var now          = DateTime.Now;
            var notification = new UserNotification(A <string>(), A <string>(), NotificationType.Advice, A <int>(), A <int>(), now);

            var transaction = new Mock <IDatabaseTransaction>();

            _transactionManager.Setup(x => x.Begin(IsolationLevel.ReadCommitted)).Returns(transaction.Object);
            _userNotificationRepository.Setup(x => x.DeleteById(notification.Id)).Returns(Maybe <OperationError> .None);

            //Act
            var result = _sut.Delete(notification.Id);

            //Assert
            Assert.True(result.IsNone);
            transaction.Verify(x => x.Commit());
        }
        public async Task Delete_ReturnsDeletedNotification()
        {
            string userNotificationsJson = File.ReadAllText(TestConfiguration.MockDataFolderPath + @"UserNotifications.json");
            var    notification          = JsonConvert.DeserializeObject <List <UserNotification> >(userNotificationsJson).First(u => u.User.Id == TESTING_USER_ID);

            UserNotificationRepository.Setup(u => u.GetByKey(notification.Id)).Returns(notification);

            UserNotificationRepository.Setup(n => n.Delete(notification.Id)).ReturnsAsync(notification);


            var resultUserNotification = await UserNotificationService.Delete(notification.Id);


            Assert.NotNull(resultUserNotification);
            Assert.Equal(notification.Title, resultUserNotification.Title);
            Assert.Equal(notification.Content, resultUserNotification.Content);
            Assert.Equal(notification.IsRead, resultUserNotification.IsRead);
            Assert.Equal(notification.CreatedDate, resultUserNotification.CreatedDate);
        }