src/Cassandra.IntegrationTests/Linq/CqlOperatorTests/SubstractAssign.cs
/// <summary>
/// Validate that SubractAssign does not change the list when an empty list of vals to delete is passed in
/// </summary>
Validate that SubractAssign does not change the list when an empty list of vals to delete is passed in
Validate that SubractAssign does not change the list when an empty list of vals to delete is passed in
[Test]
        public void SubtractAssign_FromArray_EmptyArray()
        {
            var tupleArrayType = EntityWithArrayType.SetupDefaultTable(Session);
            var table = tupleArrayType.Item1;
            var expectedEntities = tupleArrayType.Item2;
            var singleEntity = expectedEntities.First();
            string[] valsToDelete = { };
            table.Where(t => t.Id == singleEntity.Id).Select(t => new EntityWithArrayType { ArrayType = CqlOperator.SubstractAssign(valsToDelete) }).Update().Execute();
            var rows = Session.Execute($"SELECT * from {table.Name} where id=\'{singleEntity.Id}\'").GetRows().ToList();
            Assert.AreEqual(1, rows.Count);
            var actualArr = rows[0].GetValue<object>("arraytype");
            Assert.AreEqual(singleEntity.ArrayType, actualArr);
        }
[ Test ] public void SubtractAssign_FromArray_EmptyArray ( ) { var tupleArrayType = EntityWithArrayType . SetupDefaultTable ( Session ) ; var table = tupleArrayType . Item1 ; var expectedEntities = tupleArrayType . Item2 ; var singleEntity = expectedEntities . First ( ) ; string [ ] valsToDelete = { } ; table . Where ( t => t . Id == singleEntity . Id ) . Select ( t => new EntityWithArrayType { ArrayType = CqlOperator . SubstractAssign ( valsToDelete ) } ) . Update ( ) . Execute ( ) ; var rows = Session . Execute ( $" SELECT * from  { table . Name }  where id= \' { singleEntity . Id } \' " ) . GetRows ( ) . ToList ( ) ; Assert . AreEqual ( 1 , rows . Count ) ; var actualArr = rows [ 0 ] . GetValue < object > ( " " ) ; Assert . AreEqual ( singleEntity . ArrayType , actualArr ) ; }
Validate that SubractAssign does not change the list when an empty list of vals to delete is passed in
Validate that SubractAssign does not change the list when an empty list of vals to delete is passed in
// SubstractAssign the values // Validate final state of the data