예제 #1
0
        public void AttachNewEntityToContext_WhenCalled()
        {
            // Arrange
            var contextOptions = new DbContextOptionsBuilder <AlphaCinemaContext>()
                                 .UseInMemoryDatabase(databaseName: "MarkEntityAsModified_WhenCalled")
                                 .Options;

            var testMovie = new Movie {
                Name = "TestMovie"
            };

            //Act
            using (var context = new AlphaCinemaContext(contextOptions))
            {
                var movieRepo = new Repository <Movie>(context);
                movieRepo.Update(testMovie);
                //Assert
                Assert.IsTrue(context.Set <Movie>().Local.Any(e => e == testMovie));
            }
        }