Created
January 30, 2024 06:02
-
-
Save stijnmoreels/3736edaf8f3e40868dc7120be06ac171 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Fact] | |
| public void Delete_WithMessageId_ShouldDeleteMessage() | |
| { | |
| // Arrange | |
| var messageId = Guid.NewGuid().ToString(); | |
| var repo = new Mock<IMessageRepository>(); | |
| repo.Setup(r => r.DeleteMessage(messageId)).Returns(1); | |
| var cache = new Mock<IMessageCache>(); | |
| cache.Setup(c => c.Get(messageId)).Returns(Cache.NotInCache); | |
| var notifier = new Mock<IMessageNotifier>(); | |
| notifier.Setup(n => n.NewMessage(messageId)) | |
| .Returns(new NotifyResult(NotifyType.Notified)) | |
| var service = new MessageService(repo.Object, cache.Object, notifier.Object); | |
| // Act | |
| service.DeleteMessageById(messageId); | |
| // Assert | |
| repo.Verify(r => r.DeleteMessage(messageId), Times.Once); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment