src/Cassandra.IntegrationTests/Linq/LinqTable/CreateTable.cs
/// <summary>
/// Attempt to create two tables of different types but with the same name using the Create method. 
/// Validate expected failure message
/// </summary>
Attempt to create two tables of different types but with the same name using the Create method.
Validate expected failure message
Attempt to create two tables of different types but with the same name using the Create method . Validate expected failure message
[Test, TestCassandraVersion(2, 0)]
        public void TableCreate_CreateTable_SameNameDifferentTypeAlreadyExists()
        {
            const string staticTableName = "staticTableName_1";
            var mappingConfig1 = new MappingConfiguration().Define(new Map<AllDataTypesEntity>().TableName(staticTableName).CaseSensitive().PartitionKey(c => c.StringType));
            var allDataTypesTable = new Table<AllDataTypesEntity>(_session, mappingConfig1);
            allDataTypesTable.Create();
            var mappingConfig2 = new MappingConfiguration().Define(new Map<Movie>().TableName(staticTableName).CaseSensitive().PartitionKey(c => c.Title));
            var movieTable = new Table<Movie>(_session, mappingConfig2);
            Assert.Throws<AlreadyExistsException>(() => movieTable.Create());
        }
[ Test , TestCassandraVersion ( 2 , 0 ) ] public void TableCreate_CreateTable_SameNameDifferentTypeAlreadyExists ( ) { const string staticTableName = " " ; var mappingConfig1 = new MappingConfiguration ( ) . Define ( new Map < AllDataTypesEntity > ( ) . TableName ( staticTableName ) . CaseSensitive ( ) . PartitionKey ( c => c . StringType ) ) ; var allDataTypesTable = new Table < AllDataTypesEntity > ( _session , mappingConfig1 ) ; allDataTypesTable . Create ( ) ; var mappingConfig2 = new MappingConfiguration ( ) . Define ( new Map < Movie > ( ) . TableName ( staticTableName ) . CaseSensitive ( ) . PartitionKey ( c => c . Title ) ) ; var movieTable = new Table < Movie > ( _session , mappingConfig2 ) ; Assert . Throws < AlreadyExistsException > ( ( ) => movieTable . Create ( ) ) ; }
Attempt to create two tables of different types but with the same name using the Create method.
Attempt to create two tables of different types but with the same name using the Create method .
// First table name creation works as expected // Second creation attempt with same table name should fail