Beispiel #1
0
        public void CqlClientConfiguration_UseIndividualMapping_Default()
        {
            var config = new MappingConfiguration().Define(new ManyDataTypesPocoMappingCaseSensitive());
            var table  = new Table <ManyDataTypesPoco>(_session, config);

            Assert.AreNotEqual(table.Name, table.Name.ToLower()); // make sure the case sensitivity rule is being used
            table.Create();

            var mapper = new Mapper(_session, config);
            ManyDataTypesPoco manyTypesInstance = ManyDataTypesPoco.GetRandomInstance();

            mapper.Insert(manyTypesInstance);
            List <ManyDataTypesPoco> instancesQueried = mapper.Fetch <ManyDataTypesPoco>().ToList();

            Assert.AreEqual(1, instancesQueried.Count);
            manyTypesInstance.AssertEquals(instancesQueried[0]);
        }
Beispiel #2
0
        public void CqlClientConfiguration_UseIndividualMapping_Default()
        {
            // Use separate keyspace to avoid interfering with other tests
            _uniqueKsName = TestUtils.GetUniqueKeyspaceName();
            _session.CreateKeyspace(_uniqueKsName);
            _session.ChangeKeyspace(_uniqueKsName);

            var config = new MappingConfiguration().Define(new ManyDataTypesPocoMappingCaseSensitive());
            var table  = new Table <ManyDataTypesPoco>(_session, config);

            Assert.AreNotEqual(table.Name, table.Name.ToLower()); // make sure the case sensitivity rule is being used
            table.CreateIfNotExists();

            var mapper = new Mapper(_session, config);
            ManyDataTypesPoco manyTypesInstance = ManyDataTypesPoco.GetRandomInstance();

            mapper.Insert(manyTypesInstance);
            List <ManyDataTypesPoco> instancesQueried = mapper.Fetch <ManyDataTypesPoco>().ToList();

            Assert.AreEqual(1, instancesQueried.Count);
            manyTypesInstance.AssertEquals(instancesQueried[0]);
        }