Exemple #1
0
        public async Task AddCommentAsync_ShouldReturnSuccess_WhenCommentAdded()
        {
            // Arrange
            GetMock <ICommentRepository>()
            .Setup(x => x.GetAsync(Any <int>()))
            .ReturnsAsync(Any <Comment>());

            // Act
            var result = await SystemUnderTest.AddCommentAsync(Some <CommentAddRequest>());

            // Assert
            Assert.True(result.Successful);
            Assert.True(result.Result > 0);
            GetMock <IQueueClient <SetCommentToneMessage> >().Verify(x => x.SendAsync(Any <SetCommentToneMessage>()), Times.Once);
        }
Exemple #2
0
        public async Task AddCommentAsync_ShouldReturnConflictStatus_WhenCommentIdExists()
        {
            // Arrange
            var comment = Some <Comment>();

            GetMock <ICommentRepository>()
            .Setup(x => x.GetAsync(Any <int>()))
            .ReturnsAsync(comment);

            // Act
            var result = await SystemUnderTest.AddCommentAsync(Some <CommentAddRequest>());

            // Assert
            Assert.Equal(Status409Conflict, result.Reason);
        }