Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private bool ContextOpeningAndClosureTemplateStringValidation
            (string ValidatedTemplateString)
        {
            int startContextCount = templateContextHandlerProvider.CountStartContextWordIn(ValidatedTemplateString);
            int endContextCount   = templateContextHandlerProvider.CountEndContextWordIn(ValidatedTemplateString);

            return(startContextCount == endContextCount);
        }