Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use NDbUnit with schema containing dots #17

Open
savornicesei opened this issue Jan 9, 2018 · 0 comments
Open

Cannot use NDbUnit with schema containing dots #17

savornicesei opened this issue Jan 9, 2018 · 0 comments
Labels
bug 🐛 Something isn't working minor

Comments

@savornicesei
Copy link
Collaborator

Issue by ChristopheL77
Wednesday Jan 06, 2016 at 14:31 GMT
Originally opened as NDbUnit#60


I tried using NDbUnit to test Workflow Foundation 4.

WF4 uses tables with schema [System.Activities.DurableInstancing]

For example, with a table named [System.Activities.DurableInstancing].DefinitionIdentityTable, NDBUnit will fail because it splits table name with dot and then rewrites it like this : [System].[Activities].[DurableInstancing].[DefinitionIdentityTable].

I debugged a little and the method that creates the table name is : TableNameHelper.FormatTableName.

The following code works for SQLServer for tables with a schema and a table name but should be extended to support other DBMS or with tables containing database name :

`
Regex quotedExpr = new Regex(@"^((?'ns'[(\w+.)*(\w+)]).)?(([(?'tn'\w+)])|(?'tn'\w+))$");

        Match match = quotedExpr.Match(declaredTableName);
        string nmspace = null;
        string tableName = null;
        if (match != null && match.Success)
        {
            if (match.Groups["ns"].Length != 0)
            {
                nmspace = match.Groups["ns"].Value;
            }

            tableName = match.Groups["tn"].Value;

            StringBuilder result = new StringBuilder();

            if (nmspace != null)
            {
                result.Append(nmspace);
                result.Append(".");
            }
            result.AppendFormat("[{0}]", tableName);
            return result.ToString();
        }

`

@savornicesei savornicesei added bug 🐛 Something isn't working minor labels Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working minor
Projects
None yet
Development

No branches or pull requests

1 participant