public void Initialize() { var tableName = _tableNameHelper.GetTableName(); var databaseContext = UmbracoContext.Current.Application.DatabaseContext; var databaseSchemaHelper = new DatabaseSchemaHelper(databaseContext.Database, LoggerResolver.Current.Logger, databaseContext.SqlSyntax); if (!databaseSchemaHelper.TableExist(tableName)) { databaseSchemaHelper.CreateTable <NodeReport>(false); } }
public void GetTableName_OnExecute_IsCorreclyResolvedWhenTableNameAttributeIsSet() { var testDatabaseObjectRepository = new TableNameHelper <TestDatabaseObject>(); var result = testDatabaseObjectRepository.GetTableName(); Assert.AreEqual("Test", result); }
public void GetTableName_OnExecute_ThrowsExceptionWhenNotSet() { var testDatabaseObjectRepository = new TableNameHelper <TestDatabaseObjectWithoutTableName>(); testDatabaseObjectRepository.GetTableName(); }