Example #1
0
        public void MovieTagsService_DeleteByMovieIdTagId_RepositoryReturnsNull_ReturnsNull()
        {
            //Arrange
            MovieTag        movieTagNull = null;
            Task <MovieTag> movieTag     = Task.FromResult(movieTagNull);

            MovieTagService movieTagService = new MovieTagService(_mockMovieTagsRepostitory.Object);

            _mockMovieTagsRepostitory.Setup(x => x.DeleteById(It.IsAny <Guid>(), It.IsAny <int>())).Returns(movieTag);

            //Act

            var result = movieTagService.DeleteByMovieIdTagId(_movieTag.MovieId, _movieTag.Tagid).ConfigureAwait(false).GetAwaiter().GetResult();

            //Assert

            Assert.IsNull(result);
        }
Example #2
0
        public void MovieTagsService_DeleteByMovieIdTagId_ReturnsDeletedMovieTag()
        {
            //Arrange
            Task <MovieTag> movieTag = Task.FromResult(_movieTag);

            MovieTagService movieTagService = new MovieTagService(_mockMovieTagsRepostitory.Object);

            _mockMovieTagsRepostitory.Setup(x => x.DeleteById(It.IsAny <Guid>(), It.IsAny <int>())).Returns(movieTag);

            //Act

            var result = movieTagService.DeleteByMovieIdTagId(_movieTag.MovieId, _movieTag.Tagid).ConfigureAwait(false).GetAwaiter().GetResult();

            //Assert

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(MovieTagsDomainModel));
            Assert.AreEqual(result.TagId, _movieTag.Tagid);
            Assert.AreEqual(result.MovieId, _movieTag.MovieId);
        }