Exemple #1
0
            public async Task Should_return_null()
            {
                //Arrange
                Video expectedVideo = TestDataFactory.CreateVideo();

                using (VODContext context = ContextFactory.CreateContext())
                {
                    context.Videos.Add(expectedVideo);
                    context.SaveChanges();
                }

                //Act
                Video result = await RepoUnderTest.GetAsync(new Guid());

                //Assert
                Assert.Null(result);
            }
Exemple #2
0
            public async Task Should_return_the_expected_genre()
            {
                //Arrange
                Genre expectedGenre = TestDataFactory.CreateGenre();

                using (VODContext context = ContextFactory.CreateContext())
                {
                    context.Genres.Add(expectedGenre);
                    context.SaveChanges();
                }

                //Act
                Genre result = await RepoUnderTest.GetAsync(expectedGenre.Id);

                //Assert
                result.Should().BeEquivalentTo(expectedGenre);
            }
Exemple #3
0
            public async Task Should_return_the_expected_Kind()
            {
                //Arrange
                Kind expectedKind = TestDataFactory.CreateKind();

                using (VODContext context = ContextFactory.CreateContext())
                {
                    context.Kinds.Add(expectedKind);
                    context.SaveChanges();
                }

                //Act
                Kind result = await RepoUnderTest.GetAsync(expectedKind.Id);

                //Assert
                result.Should().BeEquivalentTo(expectedKind);
            }
Exemple #4
0
            public async Task Should_return_the_expected_video()
            {
                //Arrange
                Video expectedVideo = TestDataFactory.CreateVideo();

                using (VODContext context = ContextFactory.CreateContext())
                {
                    context.Videos.Add(expectedVideo);
                    context.SaveChanges();
                }

                //Act
                Video result = await RepoUnderTest.GetAsync(expectedVideo.Id);

                //Assert
                result.Should().BeEquivalentTo(expectedVideo, o =>
                                               o.Excluding(x => x.Kind)
                                               .Excluding(x => x.Genre));
            }
Exemple #5
0
            public async Task Should_return_all_genres()
            {
                //Arrange
                GenData.RepeatCount = 3;
                List <Genre> expectedGenres = new List <Genre>(GenData.RepeatCount);

                GenData.AddManyTo(expectedGenres, TestDataFactory.CreateGenre);

                using (VODContext context = ContextFactory.CreateContext())
                {
                    context.Genres.AddRange(expectedGenres);
                    context.SaveChanges();
                }

                //Act
                IEnumerable <Genre> result = await RepoUnderTest.GetAsync();

                //Assert
                result.Should().BeEquivalentTo(expectedGenres);
            }
Exemple #6
0
            public async Task Should_return_all_videos()
            {
                //Arrange
                GenData.RepeatCount = 3;
                List <Video> expectedVideos = new List <Video>(GenData.RepeatCount);

                GenData.AddManyTo(expectedVideos, TestDataFactory.CreateVideo);

                using (VODContext context = ContextFactory.CreateContext())
                {
                    context.Videos.AddRange(expectedVideos);
                    context.SaveChanges();
                }

                //Act
                IEnumerable <Video> result = await RepoUnderTest.GetAsync();

                //Assert
                result.Should().BeEquivalentTo(expectedVideos, o =>
                                               o.Excluding(x => x.Kind)
                                               .Excluding(x => x.Genre));
            }
Exemple #7
0
            public async Task Should_not_return_inactive_videos()
            {
                //Arrange
                GenData.RepeatCount = 3;
                List <Video> videos = new List <Video>(GenData.RepeatCount);

                GenData.AddManyTo(videos, TestDataFactory.CreateVideo);
                videos.Last().IsInactive = true;

                using (VODContext context = ContextFactory.CreateContext())
                {
                    context.Videos.AddRange(videos);
                    context.SaveChanges();
                }

                List <Video> expectedVideos = videos.Take(2).ToList();

                //Act
                IEnumerable <Video> result = await RepoUnderTest.GetAsync();

                //Assert
                result.Any(x => x.IsInactive).Should().BeFalse();
            }