Example #1
0
        private string GetExtendedProperty(string schemaName)
        {
            var execExtendedProperty = new ExecuteStatement();

            execExtendedProperty.ExecuteSpecification = new ExecuteSpecification();

            var name = new ChildObjectName();

            name.Identifiers.Add(new Identifier {
                Value = _scripts
            });

            var procedureReference = new ProcedureReference();

            procedureReference.Name = "sp_addextendedproperty".ToSchemaObjectName();

            var entity = new ExecutableProcedureReference();

            entity.ProcedureReference = new ProcedureReferenceName();
            entity.ProcedureReference.ProcedureReference = procedureReference;


            entity.Parameters.Add(ParametersHelper.CreateStoredProcedureParameter("@name", "tSQLt.TestClass"));
            entity.Parameters.Add(ParametersHelper.CreateStoredProcedureParameter("@value", 1));
            entity.Parameters.Add(ParametersHelper.CreateStoredProcedureParameter("@level0type", "SCHEMA"));
            entity.Parameters.Add(ParametersHelper.CreateStoredProcedureParameter("@level0name", schemaName.UnQuote()));

            execExtendedProperty.ExecuteSpecification.ExecutableEntity = entity;

            return(GenerateScript(execExtendedProperty));
        }
Example #2
0
        private void CreateFakeTableDefinition(ObjectIdentifier table)
        {
            var fakeTable = new ExecuteStatement();

            fakeTable.ExecuteSpecification = new ExecuteSpecification();

            var procedureReference = new ProcedureReference();

            procedureReference.Name = new SchemaObjectName();
            procedureReference.Name.Identifiers.Add("tSQLt".ToIdentifier());
            procedureReference.Name.Identifiers.Add("FakeTable".ToIdentifier());

            var entity = new ExecutableProcedureReference();

            entity.ProcedureReference = new ProcedureReferenceName();
            entity.ProcedureReference.ProcedureReference = procedureReference;

            entity.Parameters.Add(
                ParametersHelper.CreateStoredProcedureParameter(string.Format("{0}", table.GetSchema())));
            entity.Parameters.Add(
                ParametersHelper.CreateStoredProcedureParameter(string.Format("{0}", table.GetName())));

            fakeTable.ExecuteSpecification.ExecutableEntity = entity;

            _testProcedure.StatementList.Statements.Add(fakeTable);
        }
Example #3
0
        private void CreateAssertDefinition()
        {
            var fakeTable = new ExecuteStatement();

            fakeTable.ExecuteSpecification = new ExecuteSpecification();

            var procedureReference = new ProcedureReference();

            procedureReference.Name = new SchemaObjectName();
            procedureReference.Name.Identifiers.Add("tSQLt".ToIdentifier());
            procedureReference.Name.Identifiers.Add("AssertEquals".ToIdentifier());

            var entity = new ExecutableProcedureReference();

            entity.ProcedureReference = new ProcedureReferenceName();
            entity.ProcedureReference.ProcedureReference = procedureReference;

            entity.Parameters.Add(ParametersHelper.CreateStoredProcedureParameter("TRUE"));
            entity.Parameters.Add(ParametersHelper.CreateStoredProcedureParameter("FALSE"));

            var messageParameter = new ExecuteParameter();
            var messageValue     = new StringLiteral {
                IsNational = true, Value = "Error Not Implemented"
            };

            messageParameter.ParameterValue = messageValue;
            entity.Parameters.Add(messageParameter);

            fakeTable.ExecuteSpecification.ExecutableEntity = entity;

            _testProcedure.StatementList.Statements.Add(fakeTable);
        }
Example #4
0
 private void CreateParameterForCalleeStoredProc(Parameter parameter)
 {
     _execProc.ExecuteSpecification.ExecutableEntity.Parameters.Add(
         ParametersHelper.CreateStoredProcedureVariableParameter(parameter.Name));
 }