public void Success_when_is_validated_when_auto_generated_and_primary_appended_with_auto_generated_is_specified_in_template() { var templateHandlerNew = BuildTemplateHandler(null); var TemplateValidator = new TemplateValidator(templateHandlerNew, null); var IsColumnNotNullValueColumnContextHandler = new IsColumnNotNullValueColumnContextHandler(templateHandlerNew); var IsColumnPrimaryKeyColumnContextHandler = new IsColumnPrimaryKeyColumnContextHandler(templateHandlerNew); var IsColumnAutoGeneratedValueColumnContextHandler = new IsColumnAutoGeneratedValueColumnContextHandler(templateHandlerNew); var ColumnNameColumnContextHandler = new ColumnNameColumnContextHandler(templateHandlerNew); var TemplateHandlerNew = BuildTemplateHandler(null); String submittedString = IsColumnNotNullValueColumnContextHandler.StartContext + IsColumnPrimaryKeyColumnContextHandler.StartContext + IsColumnAutoGeneratedValueColumnContextHandler.StartContext + ColumnNameColumnContextHandler.Signature + IsColumnAutoGeneratedValueColumnContextHandler.EndContext + IsColumnPrimaryKeyColumnContextHandler.EndContext + IsColumnNotNullValueColumnContextHandler.EndContext + " " + IsColumnPrimaryKeyColumnContextHandler.StartContext + IsColumnAutoGeneratedValueColumnContextHandler.StartContext + ColumnNameColumnContextHandler.Signature + IsColumnAutoGeneratedValueColumnContextHandler.EndContext + IsColumnPrimaryKeyColumnContextHandler.EndContext; bool result = TemplateValidator.TemplateStringValidation(submittedString); bool expectedResult = true; Assert.AreEqual(expectedResult, result); }
public void Success_when_output_is_two_auto_generated_and_primary_column_name_when_auto_generated_and_primary_appended_with_auto_generated_is_specified_in_template() { var templateHandlerNew = BuildTemplateHandler(null); var IsColumnNotNullValueColumnContextHandler = new IsColumnNotNullValueColumnContextHandler(templateHandlerNew); var IsColumnPrimaryKeyColumnContextHandler = new IsColumnPrimaryKeyColumnContextHandler(templateHandlerNew); var IsColumnAutoGeneratedValueColumnContextHandler = new IsColumnAutoGeneratedValueColumnContextHandler(templateHandlerNew); var ColumnNameColumnContextHandler = new ColumnNameColumnContextHandler(templateHandlerNew); var TemplateHandlerNew = BuildTemplateHandler(null); String submittedString = IsColumnNotNullValueColumnContextHandler.StartContext + IsColumnPrimaryKeyColumnContextHandler.StartContext + IsColumnAutoGeneratedValueColumnContextHandler.StartContext + ColumnNameColumnContextHandler.Signature + IsColumnAutoGeneratedValueColumnContextHandler.EndContext + IsColumnPrimaryKeyColumnContextHandler.EndContext + IsColumnNotNullValueColumnContextHandler.EndContext + " " + IsColumnPrimaryKeyColumnContextHandler.StartContext + IsColumnAutoGeneratedValueColumnContextHandler.StartContext + ColumnNameColumnContextHandler.Signature + IsColumnAutoGeneratedValueColumnContextHandler.EndContext + IsColumnPrimaryKeyColumnContextHandler.EndContext; string result = TemplateHandlerNew.HandleTableColumnTemplate(submittedString, new ProcessorDatabaseContext() { Column = _autoAndNotNullAndPrimaryColumnDescriptionPOJO }); string expectedResult = AUTO_AND_NOT_NULL_AND_PRIMARY_COLUMN_NAME + " " + AUTO_AND_NOT_NULL_AND_PRIMARY_COLUMN_NAME; Assert.AreEqual(expectedResult, result); }
public void Success_when_is_end_context_count_match_seven() { var templateHandlerNew = BuildTemplateHandler(null); var IsColumnNotNullValueColumnContextHandler = new IsColumnNotNullValueColumnContextHandler(templateHandlerNew); var IsColumnPrimaryKeyColumnContextHandler = new IsColumnPrimaryKeyColumnContextHandler(templateHandlerNew); var IsColumnAutoGeneratedValueColumnContextHandler = new IsColumnAutoGeneratedValueColumnContextHandler(templateHandlerNew); var ColumnNameColumnContextHandler = new ColumnNameColumnContextHandler(templateHandlerNew); var provider = new TemplateContextHandlerPackageProvider <AbstractTemplateContextHandler>(BuildTemplateHandler(null), null); //TODO Add Interface Liskov Principle with TemplateHandlerNew string submittedString = IsColumnNotNullValueColumnContextHandler.StartContext + IsColumnPrimaryKeyColumnContextHandler.StartContext + IsColumnAutoGeneratedValueColumnContextHandler.StartContext + ColumnNameColumnContextHandler.Signature + IsColumnAutoGeneratedValueColumnContextHandler.EndContext + IsColumnPrimaryKeyColumnContextHandler.EndContext + IsColumnNotNullValueColumnContextHandler.EndContext + " " + IsColumnPrimaryKeyColumnContextHandler.StartContext + IsColumnAutoGeneratedValueColumnContextHandler.StartContext + ColumnNameColumnContextHandler.Signature + IsColumnAutoGeneratedValueColumnContextHandler.EndContext + IsColumnPrimaryKeyColumnContextHandler.EndContext; int result = provider.CountEndContextWordIn(submittedString); int expectedResult = 7; Assert.AreEqual(expectedResult, result); }