示例#1
0
        public void MovieTagsService_GetByMovieIdTagId_RepositoryReturnsNull_ReturnsNull()
        {
            //Arrange

            MovieTag        movieTagNull = null;
            Task <MovieTag> movieTag     = Task.FromResult(movieTagNull);

            MovieTagService movieTagService = new MovieTagService(_mockMovieTagsRepostitory.Object);

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

            //Act

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

            //Assert

            Assert.IsNull(result);
        }
示例#2
0
        public void MovieTagsService_GetByMovieIdTagId_ReturnsMovieTag()
        {
            //Arrange

            Task <MovieTag> movieTag = Task.FromResult(_movieTag);

            MovieTagService movieTagService = new MovieTagService(_mockMovieTagsRepostitory.Object);

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

            //Act

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

            //Assert

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