src/Cassandra.IntegrationTests/Mapping/Tests/FluentMapping.cs
/// <summary>
/// Validate that Fluent Mapping with CaseSensitive() method used on everything but the class name
/// which is passed in a camel case string
/// This should work the same as specifying CaseSensitive for the Class name
/// </summary>
Validate that Fluent Mapping with CaseSensitive() method used on everything but the class name
which is passed in a camel case string
This should work the same as specifying CaseSensitive for the Class name
Validate that Fluent Mapping with CaseSensitive () method used on everything but the class name which is passed in a camel case string This should work the same as specifying CaseSensitive for the Class name
[Test]
        public void Attributes_FluentMapping_CaseSensitive_NotSpecifiedForClassName()
        {
            var config = new MappingConfiguration().Define(new ClassWithCamelCaseNameMapping_CaseSensitiveNotSpecifiedForClassName());
            var table = new Table<ClassWithCamelCaseName>(Session, config);
            table.Create();
            var cqlClient = new Mapper(Session, config);
            ClassWithCamelCaseName classWithCamelCaseName = new ClassWithCamelCaseName
            {
                SomePartitionKey = Guid.NewGuid().ToString(),
                IgnoredStringAttribute = Guid.NewGuid().ToString(),
            };
            cqlClient.Insert(classWithCamelCaseName);
            string cqlSelect = "SELECT * from \"" + typeof(ClassWithCamelCaseName).Name + "\"";
            List<ClassWithCamelCaseName> records = cqlClient.Fetch<ClassWithCamelCaseName>(cqlSelect).ToList();
            Assert.AreEqual(1, records.Count);
            Assert.AreEqual(classWithCamelCaseName.SomePartitionKey, records[0].SomePartitionKey);
            ClassWithCamelCaseName defaultInstance = new ClassWithCamelCaseName();
            Assert.AreEqual(defaultInstance.IgnoredStringAttribute, records[0].IgnoredStringAttribute);
            List<Row> rows = Session.Execute(cqlSelect).GetRows().ToList();
            Assert.AreEqual(1, rows.Count);
            Assert.AreEqual(classWithCamelCaseName.SomePartitionKey, rows[0].GetValue<string>("SomePartitionKey"));
            var ex = Assert.Throws<ArgumentException>(() => rows[0].GetValue<string>("IgnoredStringAttribute"));
            StringAssert.Contains("Column IgnoredStringAttribute not found", ex.Message);
        }
[ Test ] public void Attributes_FluentMapping_CaseSensitive_NotSpecifiedForClassName ( ) { var config = new MappingConfiguration ( ) . Define ( new ClassWithCamelCaseNameMapping_CaseSensitiveNotSpecifiedForClassName ( ) ) ; var table = new Table < ClassWithCamelCaseName > ( Session , config ) ; table . Create ( ) ; var cqlClient = new Mapper ( Session , config ) ; ClassWithCamelCaseName classWithCamelCaseName = new ClassWithCamelCaseName { SomePartitionKey = Guid . NewGuid ( ) . ToString ( ) , IgnoredStringAttribute = Guid . NewGuid ( ) . ToString ( ) , } ; cqlClient . Insert ( classWithCamelCaseName ) ; string cqlSelect = " \" " + typeof ( ClassWithCamelCaseName ) . Name + " \" " ; List < ClassWithCamelCaseName > records = cqlClient . Fetch < ClassWithCamelCaseName > ( cqlSelect ) . ToList ( ) ; Assert . AreEqual ( 1 , records . Count ) ; Assert . AreEqual ( classWithCamelCaseName . SomePartitionKey , records [ 0 ] . SomePartitionKey ) ; ClassWithCamelCaseName defaultInstance = new ClassWithCamelCaseName ( ) ; Assert . AreEqual ( defaultInstance . IgnoredStringAttribute , records [ 0 ] . IgnoredStringAttribute ) ; List < Row > rows = Session . Execute ( cqlSelect ) . GetRows ( ) . ToList ( ) ; Assert . AreEqual ( 1 , rows . Count ) ; Assert . AreEqual ( classWithCamelCaseName . SomePartitionKey , rows [ 0 ] . GetValue < string > ( " " ) ) ; var ex = Assert . Throws < ArgumentException > ( ( ) => rows [ 0 ] . GetValue < string > ( " " ) ) ; StringAssert . Contains ( " " , ex . Message ) ; }
Validate that Fluent Mapping with CaseSensitive() method used on everything but the class name
which is passed in a camel case string
This should work the same as specifying CaseSensitive for the Class name
Validate that Fluent Mapping with CaseSensitive () method used on everything but the class name which is passed in a camel case string This should work the same as specifying CaseSensitive for the Class name
// Get records using mapped object, validate that the value from Cassandra was ignored in favor of the default val // Query for the column that the Linq table create created, verify no value was uploaded to it