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

IDisposable Tests #6

Open
Grauenwolf opened this issue Jun 2, 2021 · 0 comments
Open

IDisposable Tests #6

Grauenwolf opened this issue Jun 2, 2021 · 0 comments

Comments

@Grauenwolf
Copy link
Owner

foreach (var constructor in Class.Constructors.Where(c => c.IsCreatable)) 
{ 
	<text>
	
    @Tag("IDisposable")
	@TestAttribute
	public void @(Test.ClassName + "_DisposeTwice_" + constructor.SafeName)()
    {
		IDisposable objectUnderTest = @constructor.GetConstructorCode();

		try
		{
			objectUnderTest = @constructor.GetConstructorCode();
		}
		catch (ArgumentException)
		{
            return; //cannot continue test
		}

        objectUnderTest.Dispose();
        objectUnderTest.Dispose(); //second call should be a no-op 
	}
			
	</text>	
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant