src/Cassandra.IntegrationTests/Linq/LinqMethods/First.cs
/// <summary>
/// Test if driver throws exception when query without all partition keys.
/// Since Cassandra 3.10 it is not expected to throw InvalidException.
///
/// @expected_errors InvalidQueryException
/// @jira_ticket CASSANDRA-11031
/// @test_assumptions
///     - Cassandra version less than 3.10
/// </summary>

Test if driver throws exception when query without all partition keys.
Since Cassandra 3.10 it is not expected to throw InvalidException.
Test if driver throws exception when query without all partition keys . Since Cassandra 3 . 10 it is not expected to throw InvalidException .
[Test]
        [TestCassandraVersion(3, 9, Comparison.LessThan)]
        public void First_MissingPartitionKey()
        {
            var randomStr = "somethingrandom_" + Randomm.RandomAlphaNum(10);
            try
            {
                _movieTable.First(m => m.Title == randomStr).Execute();
                Assert.Fail("expected exception was not thrown!");
            }
            catch (InvalidQueryException e)
            {
                string expectedErrMsg = "Partition key part(s:)? movie_maker must be restricted (since preceding part is|as other parts are)";
                StringAssert.IsMatch(expectedErrMsg, e.Message);
            }
        }
[ Test ] [ TestCassandraVersion ( 3 , 9 , Comparison . LessThan ) ] public void First_MissingPartitionKey ( ) { var randomStr = " " + Randomm . RandomAlphaNum ( 10 ) ; try { _movieTable . First ( m => m . Title == randomStr ) . Execute ( ) ; Assert . Fail ( " " ) ; } catch ( InvalidQueryException e ) { string expectedErrMsg = " " ; StringAssert . IsMatch ( expectedErrMsg , e . Message ) ; } }
<summary>
Test if driver throws exception when query without all partition keys.
<summary > Test if driver throws exception when query without all partition keys .
expected_errors
None
jira_ticket
None
test_assumptions

Cassandra version less than 3.10

Cassandra version less than 3 . 10