Skip to content

A tool to generate C# methods as well as test cases quickly.

Notifications You must be signed in to change notification settings

proinfocus/TestCaseGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Case Generator

A tool to generate C# methods as well as test cases for those methods, quickly.

What's new?

Current update can now create test cases to Assert.Throw and remove duplicate method generation in the Regular class and also defines the way you could generate it as part of the comment just above the method.

System Requirements

It requires .Net Framework 4.0 and above to work with no other dependencies.

How it works?

You either type the Test case inline or create a bunch of test cases in a .txt file and pass on the file location and the tool will create all those methods on your left and test cases on your right. You could just copy them to your respective class files and take it further.

The tool aims and keeping focus on rapid development without compromising the quality of the code. Download the files and test it out today and make C# development lot quicker and better.

Note: The test case methods have [Fact] attributed as it was developed for xunit. You could just replace those with [Test] or whatever.

Structure of the Test Case

Here is one of the sample test case:

Add(1,2) = 3 => Should_Add_Two_Numbers();

Add(1,2) = 3 is the actual method you will be implementing. Add(1,2) is the method signature, = 3 is the return value. This is used in the test case generation.

Should_Add_Two_Numbers(); is the test case for the implementation.

=> is the separator.

For Exceptions

Here is one of the sample test case:

Add(1,2) = 3,ArgumentNullException => Should_Throw_ArgumentNullException();

Add(1,2) = 3 is the actual method you will be implementing. Add(1,2) is the method signature, = 3 is the return value. However ArgumentNullException defined in the return value, separated by Comma, will create the test case to Assert.Throws instead of Assert.Equal.

Should_Throw_ArgumentNullException(); is the test case for the implementation.

=> is the separator.

Sample showing generation from Text File

alt text

Sample showing generation from inline Test case

alt text

Happy C# Coding!

About

A tool to generate C# methods as well as test cases quickly.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages