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,
/// setting table name of second create request via table name override option in constructor
/// Validate expected failure message
/// </summary>
Attempt to create two tables of different types but with the same name using the Create method,
setting table name of second create request via table name override option in constructor
Validate expected failure message
Attempt to create two tables of different types but with the same name using the Create method setting table name of second create request via table name override option in constructor Validate expected failure message
[Test, TestCassandraVersion(2, 0)]
        public void TableCreate_CreateTable_SameNameDifferentTypeAlreadyExists_TableNameOverride()
        {
            const string staticTableName = "staticTableName_2";
            var mappingConfig = new MappingConfiguration().Define(new Map<AllDataTypesEntity>().TableName(staticTableName).CaseSensitive().PartitionKey(c => c.StringType));
            var allDataTypesTable = new Table<AllDataTypesEntity>(_session, mappingConfig);
            allDataTypesTable.Create();
            var movieTable = new Table<Movie>(_session, new MappingConfiguration(), staticTableName);
            Assert.Throws<AlreadyExistsException>(() => movieTable.Create());
        }
[ Test , TestCassandraVersion ( 2 , 0 ) ] public void TableCreate_CreateTable_SameNameDifferentTypeAlreadyExists_TableNameOverride ( ) { const string staticTableName = " " ; var mappingConfig = new MappingConfiguration ( ) . Define ( new Map < AllDataTypesEntity > ( ) . TableName ( staticTableName ) . CaseSensitive ( ) . PartitionKey ( c => c . StringType ) ) ; var allDataTypesTable = new Table < AllDataTypesEntity > ( _session , mappingConfig ) ; allDataTypesTable . Create ( ) ; var movieTable = new Table < Movie > ( _session , new MappingConfiguration ( ) , staticTableName ) ; Assert . Throws < AlreadyExistsException > ( ( ) => movieTable . Create ( ) ) ; }
Attempt to create two tables of different types but with the same name using the Create method,
setting table name of second create request via table name override option in constructor
Validate expected failure message
Attempt to create two tables of different types but with the same name using the Create method setting table name of second create request via table name override option in constructor Validate expected failure message
// First table name creation works as expected // Second creation attempt with same table name should fail