src/Cassandra.IntegrationTests/Linq/LinqMethods/Update.cs
/// <summary>
/// Successfully update multiple records using a single (non-batch) update, using async execute
/// </summary>
Successfully update multiple records using a single (non-batch) update, using async execute
Successfully update multiple records using a single ( non - batch ) update using async execute
[Test]
        public void LinqUpdate_Single_Async()
        {
            var table = new Table<Movie>(_session, new MappingConfiguration());
            table.CreateIfNotExists();
            var movieToUpdate = _movieList[1];
            var expectedMovie = new Movie(movieToUpdate.Title, movieToUpdate.Director, "something_different_" + Randomm.RandomAlphaNum(10), movieToUpdate.MovieMaker, 1212);
            table.Where(m => m.Title == movieToUpdate.Title && m.MovieMaker == movieToUpdate.MovieMaker && m.Director == movieToUpdate.Director)
                 .Select(m => new Movie { Year = expectedMovie.Year, MainActor = expectedMovie.MainActor })
                 .Update()
                 .Execute();
            var actualMovieList = table.ExecuteAsync().Result.ToList();
            Assert.AreEqual(_movieList.Count, actualMovieList.Count());
            Assert.IsFalse(Movie.ListContains(_movieList, expectedMovie));
            Movie.AssertListContains(actualMovieList, expectedMovie);
        }
[ Test ] public void LinqUpdate_Single_Async ( ) { var table = new Table < Movie > ( _session , new MappingConfiguration ( ) ) ; table . CreateIfNotExists ( ) ; var movieToUpdate = _movieList [ 1 ] ; var expectedMovie = new Movie ( movieToUpdate . Title , movieToUpdate . Director , " " + Randomm . RandomAlphaNum ( 10 ) , movieToUpdate . MovieMaker , 1212 ) ; table . Where ( m => m . Title == movieToUpdate . Title && m . MovieMaker == movieToUpdate . MovieMaker && m . Director == movieToUpdate . Director ) . Select ( m => new Movie { Year = expectedMovie . Year , MainActor = expectedMovie . MainActor } ) . Update ( ) . Execute ( ) ; var actualMovieList = table . ExecuteAsync ( ) . Result . ToList ( ) ; Assert . AreEqual ( _movieList . Count , actualMovieList . Count ( ) ) ; Assert . IsFalse ( Movie . ListContains ( _movieList , expectedMovie ) ) ; Movie . AssertListContains ( actualMovieList , expectedMovie ) ; }
Successfully update multiple records using a single (non-batch) update, using async execute
Successfully update multiple records using a single ( non - batch ) update using async execute
// Setup