Beispiel #1
0
        public void SaveChanges_CallsDbContextSaveChanges()
        {
            // Act
            _sut.SaveChanges();

            // Assert
            _context.Received(1).SaveChanges();
        }
        public void SaveChangesShouldCallDbContextSaveChanges()
        {
            // Arrange
            var context = new Mock <DbContext>();
            var users   = new List <User>();

            context.Setup(m => m.Set <User>()).Returns(new FakeSet <User>(users));
            var entityFrameworkUnitOfWork = new EntityFrameworkUnitOfWork(context.Object);

            // Act
            entityFrameworkUnitOfWork.SaveChanges();

            // Assert
            context.Verify(m => m.SaveChanges(), Times.Once);
        }