Created
January 30, 2024 06:02
-
-
Save stijnmoreels/932f9df1d7f6ba91c5927bba3975bd91 to your computer and use it in GitHub Desktop.
This file contains 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 | |
Message[] leftOverMessages = CreateMessages(); | |
Message targetMessage = CreateMessage(); | |
var repo = new InMemoryMessageRepository(leftOverMessages.Append(targetMessage)); | |
var service = CreateMessageService(repo); | |
// Act | |
DeleteResult result = service.DeleteMessageById(targetMessage.Id); | |
// Assert | |
Assert.Equal(DeleteResult.Deleted, result); | |
Assert.Equal(targetMessage.Id, result.Value); | |
Message[] actual = repo.GetMessages(); | |
Assert.DoesNotContain(targetMessage, actual); | |
Assert.All(leftOverMessages, msg => Assert.Contains(msg, actual)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment