Click here to Skip to main content
15,886,860 members
Articles / Programming Languages / C#

Pragmatic Unit Tests using "yield return" for providing test cases

Rate me:
Please Sign up or sign in to vote.
4.33/5 (5 votes)
5 Feb 2013CPOL3 min read 38.6K   120   14  
How to gain better control over the testing process reducing the amount of test methods in a unit test.

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject1", "TestProject1\TestProject1.csproj", "{6D1FAA9E-2A23-41AD-BED9-F984D3C92592}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BBC5C2AB-D4FD-4B68-8D0D-4DA7205FCF99}"
	ProjectSection(SolutionItems) = preProject
		Local.testsettings = Local.testsettings
		TestProject1.vsmdi = TestProject1.vsmdi
		TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
	EndProjectSection
EndProject
Global
	GlobalSection(TestCaseManagementSettings) = postSolution
		CategoryFile = TestProject1.vsmdi
	EndGlobalSection
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{6D1FAA9E-2A23-41AD-BED9-F984D3C92592}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{6D1FAA9E-2A23-41AD-BED9-F984D3C92592}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{6D1FAA9E-2A23-41AD-BED9-F984D3C92592}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{6D1FAA9E-2A23-41AD-BED9-F984D3C92592}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

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) Polenter - Software Solutions
Germany Germany
I'm C# developer from Cologne, Germany. Here I owe a small software company. My hobby is general optimization - natural talent of all lazy people Wink | ;-)

Comments and Discussions