-
Notifications
You must be signed in to change notification settings - Fork 0
Doing some renaming #25
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f2210ad
Doing some renaming
PandaMagnus 6179295
Removing hardcoded version
PandaMagnus 4202ab4
Updating tests to reference un-obsoleted class and method names
PandaMagnus ef6713f
Updating release notes to fix typo
PandaMagnus d5d80ab
Resolving merge conflicts
a22b89a
Fixing code analysis issue
1f35de6
Upping a timeout in a unit test to make sure all conditions are met
0d8509e
Upping timeout on some unit tests
11e53cd
Upping timeout on test
a07353f
Some changes to unit tests to make sure each test has its own test ob…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| using System; | ||
| using System.Diagnostics; | ||
|
|
||
| namespace IntelliTect.IntelliWait.Tests | ||
| { | ||
| public class FakeTestClass | ||
| { | ||
| public void ThrowExceptionWithNoReturn() | ||
| { | ||
| throw new Exception(); | ||
| } | ||
|
|
||
| public bool ThrowExceptionWithReturn() | ||
| { | ||
| throw new Exception(); | ||
| } | ||
|
|
||
| public void ThrowNullRefExceptionWithNoReturn() | ||
| { | ||
| throw new NullReferenceException(); | ||
| } | ||
|
|
||
| public bool ThrowNullRefExceptionWithReturn() | ||
| { | ||
| throw new NullReferenceException(); | ||
| } | ||
|
|
||
| public void CheckExceptionsVoidReturn(int secondsToFail = 1, int numberOfDifferentExceptions = 1) | ||
| { | ||
| ThrowExceptions(secondsToFail, numberOfDifferentExceptions); | ||
| } | ||
|
|
||
| public bool CheckExceptionsBoolReturn(int secondsToFail = 1, int numberOfDifferentExceptions = 1) | ||
| { | ||
| ThrowExceptions(secondsToFail, numberOfDifferentExceptions); | ||
| return true; | ||
| } | ||
|
|
||
| // Find a better way to do this to better facilitate test parallelization | ||
| private void ThrowExceptions(int secondsToFail, int numberOfExceptions) | ||
| { | ||
| if (_Timeout == TimeSpan.MinValue) | ||
| { | ||
| _Timeout = TimeSpan.FromSeconds(secondsToFail); | ||
| _Sw.Start(); | ||
| } | ||
|
|
||
| while (_Sw.Elapsed <= _Timeout) | ||
| { | ||
| _Attempts++; | ||
| if (_Attempts > numberOfExceptions) | ||
| { | ||
| _Attempts = 1; | ||
| } | ||
| switch (_Attempts) | ||
| { | ||
| case 1: | ||
| throw new InvalidOperationException(); | ||
| case 2: | ||
| throw new InvalidProgramException(); | ||
| case 3: | ||
| throw new IndexOutOfRangeException(); | ||
| case 4: | ||
| throw new ArgumentNullException(); | ||
| case 5: | ||
| throw new FieldAccessException(); | ||
| default: | ||
| throw new ArgumentException(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private int _Attempts = 0; | ||
| private TimeSpan _Timeout = TimeSpan.MinValue; | ||
| private Stopwatch _Sw = new Stopwatch(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are a couple of logic errors here.
ThrowExceptionsyou do start it on the first pass, but then you never Stop/Restart the stop watch. Meaning that you might never get inside of the while loop.