Ejemplo n.º 1
0
        public async Task VideoGetByIdCorrectly()
        {
            var videoList = new List <Video>();
            var videoRepo = new Mock <IDeletableEntityRepository <Video> >();

            videoRepo.Setup(x => x.All()).Returns(videoList.AsQueryable());
            videoRepo.Setup(x => x.AddAsync(It.IsAny <Video>()))
            .Callback((Video x) => videoList.Add(x));

            await videoRepo.Object.AddAsync(this.test);

            var videoService = new VideosService(videoRepo.Object);

            var videoResult = videoService.GetById(this.test.Id);

            Assert.Equal(test, videoResult);
        }