Esempio n. 1
0
        public async Task DeleteProjectCommentAsync_ValidRequest_ShouldDeleteProjectComment()
        {
            // Arrange
            var existingProject = new GetProjectPayload
            {
                Id = Guid.NewGuid().ToString(),
            };

            var existingProjectComment = new GetProjectCommentPayload
            {
                Id = Guid.NewGuid().ToString(),
            };

            var expectedResponseContent =
                new StringContent(JsonConvert.SerializeObject(existingProjectComment, this.fixture.JsonSerializerSettings));

            var expectedResponse = new HttpResponseMessage
            {
                Content = expectedResponseContent,
            };

            var projectApi = this.fixture.GetProjectApi(expectedResponse);

            var deleteProjectCommentResponse = new DeleteProjectCommentResponse();

            // Act
            Func <Task> act = async() => deleteProjectCommentResponse = await projectApi.DeleteProjectCommentAsync(existingProject.Id, existingProjectComment.Id);

            // Assert
            await act.Should().NotThrowAsync();

            deleteProjectCommentResponse.Id.Should().Be(existingProjectComment.Id);
        }
Esempio n. 2
0
        public async Task DeleteProjectCommentAsync_InvalidProjectId_ShouldThrowArgumentNullException(string projectId)
        {
            // Arrange
            var existingProjectComment = new GetProjectCommentPayload
            {
                Id = Guid.NewGuid().ToString(),
            };

            var projectApi = this.fixture.GetProjectApi();

            // Act
            Func <Task> act = async() => await projectApi.DeleteProjectCommentAsync(projectId, existingProjectComment.Id);

            // Assert
            await act.Should().ThrowAsync <ArgumentNullException>();
        }