Exemple #1
0
        public void Movies_Controller_Should_Verify_Available_Name()
        {
            // Arrange
            bool available = true;

            _movieServiceMock.Setup(c => c.IsNameAlreadyInUse(It.IsAny <string>(), It.IsAny <long>())).Returns(available);

            // Action
            IHttpActionResult callback = _moviesController.CheckName(_movieNameQuery.Object);

            // Assert
            var httpResponse = callback.Should().BeOfType <OkNegotiatedContentResult <bool> >().Subject;

            httpResponse.Content.Should().Be(available);
            _movieServiceMock.Verify(s => s.IsNameAlreadyInUse(It.IsAny <string>(), It.IsAny <long>()), Times.Once);
            _movieServiceMock.VerifyNoOtherCalls();
        }