Click here to Skip to main content
15,891,428 members
Articles / Programming Languages / XSLT

Custom Configuration SQL Connection String Section

Rate me:
Please Sign up or sign in to vote.
3.42/5 (7 votes)
23 Jan 2006CPOL5 min read 90.2K   1K   24  
This solution demonstrates enforcing valid SQL connection strings in the App.Config file.
XML Format Test Cases Executed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Empty Optional SqlConnectionConfigurationSection
	Presets:
		- Comment out SqlConnectionConfigurationSection
		- Comment out appSetting "MandatorySqlConnectionConfigurationSection"
	Expected Result:
		No exceptions, no output

2. Optional SqlConnectionConfigurationSection Output
	Presets:
		- Ensure SqlConnectionConfigurationSection is not commented out
		a. Missing appSetting "MandatorySqlConnectionConfigurationSection"
			Expected Result:
				No exceptions, SqlConnectionStrings sent to CONSOLE
		b. appSetting "MandatorySqlConnectionConfigurationSection" = "false"
			Expected Result;
				No exceptions, SqlConnectionStrings sent to CONSOLE

3. Missing Mandatory SqlConnectionConfigurationSection
	Presets:
		- Comment out SqlConnectionConfigurationSection
		- Set appSetting "MandatorySqlConnectionConfigurationSection" = "true"
	Expected Result:
		Exception

4. Set invalid SqlConnectionString attribute ID
	Presets:
		- Ensure SqlConnectionConfigurationSection is not commented out
		- Change name of ID attribute for one SqlConnectionString tag to "FooBar"
	Excepted result:
		Exception

4. Invalid SqlConnectionConfigurationSection
	Presets
		- Comment out all SqlConnectionString groups
	Expected result:
		Exception

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Canada Canada
Very experienced Senior Software Developer/Manager with natural leadership and proven project management skills.

Started in Civil Engineering leading the integration of PC's into the Engineering process as a Design/Drafting Technician as well as an in-house Software Developer then transitioned into a full time Software Development career in the early 90's.

Ability to change and adapt has led to diverse experience with a wide array of technology and roles from graphics or web development to designing line of business enterprise applications.

Knowledge Base: Sharepoint, C#, SQL, ASP.NET, C++, CSS, HTML, JavaScript, XML, XSLT

Comments and Discussions