src/Cassandra.IntegrationTests/Linq/CqlOperatorTests/SubstractAssign.cs
/// <summary>
/// Attempt to use SubtractAssign to remove a single value from a dictionary that contains a single value
/// Validate Error response
/// </summary>
Attempt to use SubtractAssign to remove a single value from a dictionary that contains a single value
Validate Error response
Attempt to use SubtractAssign to remove a single value from a dictionary that contains a single value Validate Error response
[Test]
        public void SubtractAssign_FromDictionary_NotAllowed()
        {
            var tupleDictionaryType = EntityWithDictionaryType.SetupDefaultTable(Session);
            var table = tupleDictionaryType.Item1;
            var expectedEntities = tupleDictionaryType.Item2;
            var singleEntity = expectedEntities.First();
            var expectedEntity = singleEntity.Clone();
            expectedEntity.DictionaryType.Clear();
            var dictToDelete = new Dictionary<string, string>() { 
                { singleEntity.DictionaryType.First().Key, singleEntity.DictionaryType.First().Value }, 
            };
            var updateStatement = table.Where(t => t.Id == singleEntity.Id).Select(t => new EntityWithDictionaryType
            {
                DictionaryType = CqlOperator.SubstractAssign(dictToDelete)
            }).Update();
            Assert.Throws<InvalidOperationException>(() => updateStatement.Execute(),
                "Use dedicated method to substract assign keys only for maps");
        }
[ Test ] public void SubtractAssign_FromDictionary_NotAllowed ( ) { var tupleDictionaryType = EntityWithDictionaryType . SetupDefaultTable ( Session ) ; var table = tupleDictionaryType . Item1 ; var expectedEntities = tupleDictionaryType . Item2 ; var singleEntity = expectedEntities . First ( ) ; var expectedEntity = singleEntity . Clone ( ) ; expectedEntity . DictionaryType . Clear ( ) ; var dictToDelete = new Dictionary < string , string > ( ) { { singleEntity . DictionaryType . First ( ) . Key , singleEntity . DictionaryType . First ( ) . Value } , } ; var updateStatement = table . Where ( t => t . Id == singleEntity . Id ) . Select ( t => new EntityWithDictionaryType { DictionaryType = CqlOperator . SubstractAssign ( dictToDelete ) } ) . Update ( ) ; Assert . Throws < InvalidOperationException > ( ( ) => updateStatement . Execute ( ) , " " ) ; }
Attempt to use SubtractAssign to remove a single value from a dictionary that contains a single value
Validate Error response
Attempt to use SubtractAssign to remove a single value from a dictionary that contains a single value Validate Error response
// Attempt to remove the data // Use incorrect substract assign overload