public void AddAuthor_WithCorrectData_ShouldAddAuthorAndReturn201Created()
        {
            // Arrange
            var authors = new List<Author>();

            // Act
            var mockContext = new Mock<IMoviesGalleryData>();

            mockContext.Setup(r => r.Authors).Returns(this.mockContainer.AuthorRepositoryMock.Object);

            var controller = new AuthorsController(mockContext.Object);
            this.SetupController(controller);
            this.mockContainer.AuthorRepositoryMock.Setup(r => r.Add(It.IsAny<Author>()))
                .Callback((Author author) =>
                {
                    authors.Add(author);
                });
            var authorModel = new AddAuthorInputModel() { Name = "TestAuthor", DateOfBirth = new DateTime(2000, 1, 1) };

            var httpPostResponse = controller.PostAuthor(authorModel).ExecuteAsync(CancellationToken.None).Result;

            var result = httpPostResponse.Content.ReadAsAsync<ShortActorDataModel>().Result;

            // Assert
            mockContext.Verify(c => c.SaveChanges(), Times.Once);
            Assert.AreEqual(1, authors.Count);
            Assert.AreEqual(authorModel.Name, result.Name);
        }
        public void AddAuthor_WithInvalidData_ShouldReturn400BadRequest()
        {
            // Arrange
            var authors = new List<Author>();

            // Act
            var mockContext = new Mock<IMoviesGalleryData>();

            mockContext.Setup(r => r.Authors).Returns(this.mockContainer.AuthorRepositoryMock.Object);

            var controller = new AuthorsController(mockContext.Object);
            this.SetupController(controller);
            this.mockContainer.AuthorRepositoryMock.Setup(r => r.Add(It.IsAny<Author>()))
                .Callback((Author author) =>
                {
                    authors.Add(author);
                });
            var httpPostResponse = controller.PostAuthor(null).ExecuteAsync(CancellationToken.None).Result;

            // Assert
            Assert.AreEqual(HttpStatusCode.BadRequest, httpPostResponse.StatusCode);
            Assert.AreEqual(0, authors.Count);
        }