Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4593590
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:42:23+00:00 2026-05-21T22:42:23+00:00

I am trying to use the NDbUnit. I have created seperate XSD for each

  • 0

I am trying to use the NDbUnit. I have created seperate XSD for each table instead of one large XSD for complete database.

My tests run fine when I use only single XSD and singe xml read. However for a perticular test, I need to have data in two or three different (but related) tables. If I try to read more than one xsd and xml, then it throws exception.

Here is my code

        [ClassInitialize()]
        public static void MyClassInitialize(TestContext testContext)
        {
            IDbConnection connection = DbConnection.GetCurrentDbConnection();
            _mySqlDatabase = new NDbUnit.Core.SqlClient.SqlDbUnitTest(connection);
            _mySqlDatabase.ReadXmlSchema(@"Data\CompanyMaster.xsd");  
            _mySqlDatabase.ReadXml(@"Data\CompanyMaster.xml");
            _mySqlDatabase.ReadXmlSchema(@"Data\License.xsd");
            _mySqlDatabase.ReadXml(@"Data\License.xml");
            _mySqlDatabase.ReadXmlSchema(@"Data\LicenseDetails.xsd");
            _mySqlDatabase.ReadXml(@"Data\LicenseDetails.xml");
            _mySqlDatabase.ReadXmlSchema(@"RelatedLicense.xsd");
            _mySqlDatabase.ReadXml(@"Data\RelatedLicense.xml");    
        }

Here is the exception I get at the point where i try to read License.XSD as shown above

Class Initialization method
ESMS.UnitTest.CompanyManagerTest.MyClassInitialize
threw exception.
System.ArgumentException:
System.ArgumentException: Item has
already been added. Key in dictionary:
‘EnableTableAdapterManager’ Key being
added: ‘EnableTableAdapterManager’.

I am not sure if this is the correct way of reading multiple XML,XSD with NDbUnit. I googled and Overflowed (i.e. searched stack overflow), but could not get any sensible direction. Could someone explain what is going wrong and how to correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T22:42:24+00:00Added an answer on May 21, 2026 at 10:42 pm

    Sbohlen showed me the way.

    It’s true that as thing stands as of now, loading of multiple XSD’s is not supported.

    However fortunately loading of multiple XMLs against single XSD is possible.

    So what I did was created a single XSD and pulled in all related tables onto it. Then used the AppendXml sytanx available along side of ReadXml. This way I could load the required test data into multiple tables and my tests started getting passed.

    This link would share more lights about the AppendXml http://code.google.com/p/ndbunit/issues/detail?id=27

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am trying to use NHiberanate with NDbUnit but I cannot as NDbUnit tried
I have been trying use the edit_post_link() function to contain an image. All of
Trying to use records with the cursor and later index by table in the
I'm trying use eco for client-side templating. I have multiple .eco templates that I'd
I have a regex that I'm trying use to validate against strings. Trying to
I have a 3rd party DLL that I am trying to use in a
I am trying use Thread but i have some problem (I am beginner at
I am trying use the jQuery table sorter plugin for a table that is
I am trying use jQuery to poll dynamic DOM nodes, created outside of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.