src/Cassandra.IntegrationTests/Linq/LinqMethods/Update.cs
/// <summary>
/// Try to update a non existing record
/// </summary>
Try to update a non existing record
Try to update a non existing record
[Test, TestCassandraVersion(2, 0)]
        public void LinqUpdate_IfExists()
        {
            var table = new Table<Movie>(_session, new MappingConfiguration());
            table.CreateIfNotExists();
            var unexistingMovie = new Movie("Unexisting movie title", "Unexisting movie director", "Unexisting movie actor", "Unexisting movie maker", 1212);
            var cql = table.Where(m => m.Title == unexistingMovie.Title && m.MovieMaker == unexistingMovie.MovieMaker && m.Director == unexistingMovie.Director)
                           .Select(m => new Movie { Year = unexistingMovie.Year, MainActor = unexistingMovie.MainActor })
                           .UpdateIfExists();
            var appliedInfo = cql.Execute();
            Assert.IsFalse(appliedInfo.Applied);
            var actualMovieList = table.Execute().ToList();
            Assert.AreEqual(_movieList.Count, actualMovieList.Count());
            Assert.IsFalse(Movie.ListContains(actualMovieList, unexistingMovie));
        }
[ Test , TestCassandraVersion ( 2 , 0 ) ] public void LinqUpdate_IfExists ( ) { var table = new Table < Movie > ( _session , new MappingConfiguration ( ) ) ; table . CreateIfNotExists ( ) ; var unexistingMovie = new Movie ( " " , " " , " " , " " , 1212 ) ; var cql = table . Where ( m => m . Title == unexistingMovie . Title && m . MovieMaker == unexistingMovie . MovieMaker && m . Director == unexistingMovie . Director ) . Select ( m => new Movie { Year = unexistingMovie . Year , MainActor = unexistingMovie . MainActor } ) . UpdateIfExists ( ) ; var appliedInfo = cql . Execute ( ) ; Assert . IsFalse ( appliedInfo . Applied ) ; var actualMovieList = table . Execute ( ) . ToList ( ) ; Assert . AreEqual ( _movieList . Count , actualMovieList . Count ( ) ) ; Assert . IsFalse ( Movie . ListContains ( actualMovieList , unexistingMovie ) ) ; }
Try to update a non existing record
Try to update a non existing record
// Setup