public void SuccessfullyAttachUntrackedEntity() { var connection = TestConfiguration.GetConnection(); var context = new MongoDbContext(connection); var dbSet = new MongoDbSet <DbSetModel>(context); var model = new DbSetModel { Id = "abcd" }; dbSet.Add(model); context.SaveChanges(); ResetMongoDb(); context = new MongoDbContext(connection); dbSet = new MongoDbSet <DbSetModel>(context); var result = dbSet.AsNoTracking().FirstOrDefault(); context.Attach(result); Assert.AreEqual(MongoFramework.Infrastructure.EntityEntryState.NoChanges, context.ChangeTracker.GetEntry(result).State); }