Esempio n. 1
0
        public void TableCreate_Create_KeyspaceOverride_NoSuchKeyspace()
        {
            var uniqueTableName = TestUtils.GetUniqueTableName();
            var uniqueKsName    = TestUtils.GetUniqueKeyspaceName();

            if (!TestClusterManager.SchemaManipulatingQueriesThrowInvalidQueryException())
            {
                TestCluster.PrimeFluent(
                    b => b.WhenQuery(string.Format(CreateTable.CreateCqlFormatStr, $"\"{uniqueKsName}\".\"{uniqueTableName}\""))
                    .ThenServerError(ServerError.ConfigError, "msg"));
            }
            else
            {
                TestCluster.PrimeFluent(
                    b => b.WhenQuery(string.Format(CreateTable.CreateCqlFormatStr, $"\"{uniqueKsName}\".\"{uniqueTableName}\""))
                    .ThenServerError(ServerError.Invalid, "msg"));
            }

            var table = new Table <AllDataTypesEntity>(Session, new MappingConfiguration(), uniqueTableName, uniqueKsName);

            if (!TestClusterManager.SchemaManipulatingQueriesThrowInvalidQueryException())
            {
                Assert.Throws <InvalidConfigurationInQueryException>(() => table.Create());
            }
            else
            {
                Assert.Throws <InvalidQueryException>(() => table.Create());
            }
        }