Beispiel #1
0
            public void Should_update_and_return_the_specified_video()
            {
                // Arrange
                Kind  newKind  = TestDataFactory.CreateKind();
                Genre newGenre = TestDataFactory.CreateGenre();
                Video oldVideo = TestDataFactory.CreateVideo();

                using (VODContext context = ContextFactory.CreateContext())
                {
                    context.Videos.Add(oldVideo);
                    context.Genres.Add(newGenre);
                    context.Kinds.Add(newKind);
                    context.SaveChanges();
                }

                Video newVideo = TestDataFactory.CreateVideo(newKind, newGenre);

                newVideo.Id = oldVideo.Id;

                //Act
                Video result = RepoUnderTest.Update(newVideo);

                //Assert
                result.Should().BeEquivalentTo(newVideo);
            }
Beispiel #2
0
            public void Should_update_and_return_the_specified_genre()
            {
                // Arrange
                Genre oldGenre = TestDataFactory.CreateGenre();

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

                Genre newGenre = new Genre()
                {
                    Id     = oldGenre.Id,
                    Name   = "new genre",
                    Videos = null
                };

                // Act
                Genre result = RepoUnderTest.Update(newGenre);

                // Assert
                result.Should().BeEquivalentTo(newGenre);
            }
Beispiel #3
0
            public void Should_update_and_return_the_specified_Kind()
            {
                // Arrange
                Kind oldKind = TestDataFactory.CreateKind();

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

                Kind newKind = new Kind()
                {
                    Id     = oldKind.Id,
                    Name   = "new Kind",
                    Videos = null
                };

                // Act
                Kind result = RepoUnderTest.Update(newKind);

                // Assert
                result.Should().BeEquivalentTo(newKind);
            }