Esempio n. 1
0
        public void Insert_MislabledClusteringKey()
        {
            string tableName      = typeof(PocoWithAdditionalField).Name.ToLower();
            string createTableCql = "Create table " + tableName + "(somestring text PRIMARY KEY)";

            _session.Execute(createTableCql);
            var cqlClient = new Mapper(_session, new MappingConfiguration());
            PocoWithAdditionalField pocoWithCustomAttributes = new PocoWithAdditionalField();

            // Validate expected exception
            var ex = Assert.Throws <InvalidQueryException>(() => cqlClient.Insert(pocoWithCustomAttributes));

            StringAssert.Contains("Unknown identifier someotherstring", ex.Message);
        }
Esempio n. 2
0
        public void Insert_MislabledClusteringKey()
        {
            string tableName      = typeof(PocoWithAdditionalField).Name.ToLower();
            string createTableCql = "Create table " + tableName + "(somestring text PRIMARY KEY)";

            _session.Execute(createTableCql);
            var cqlClient = new Mapper(_session, new MappingConfiguration());
            PocoWithAdditionalField pocoWithCustomAttributes = new PocoWithAdditionalField();

            // Validate expected exception
            var ex = Assert.Throws <InvalidQueryException>(() => cqlClient.Insert(pocoWithCustomAttributes));
            var expectedMessage = "Unknown identifier someotherstring";

            if (TestClusterManager.CheckCassandraVersion(false, Version.Parse("3.10"), Comparison.GreaterThanOrEqualsTo))
            {
                expectedMessage = "Undefined column name someotherstring";
            }
            StringAssert.Contains(expectedMessage, ex.Message);
        }
Esempio n. 3
0
        public void Insert_MislabledClusteringKey()
        {
            string tableName = typeof(PocoWithAdditionalField).Name.ToLower();
            string createTableCql = "Create table " + tableName + "(somestring text PRIMARY KEY)";
            _session.Execute(createTableCql);
            var cqlClient = new Mapper(_session, new MappingConfiguration());
            PocoWithAdditionalField pocoWithCustomAttributes = new PocoWithAdditionalField();

            // Validate expected exception
            var ex = Assert.Throws<InvalidQueryException>(() => cqlClient.Insert(pocoWithCustomAttributes));
            StringAssert.Contains("Unknown identifier someotherstring", ex.Message);
        }