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

Assignment9+10: Jake + Kevin #82

Open
wants to merge 40 commits into
base: Assignment9+10-Multithreading
Choose a base branch
from

Conversation

JacobLucas02
Copy link

collaborated with @kflannery2001

Copy link

@dpalmer10 dpalmer10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement PingProcess' public Task<PingResult> RunTaskAsync(string hostNameOrAddress) ✔
    First implement public void RunTaskAsync_Success() test method to test PingProcess.RunTaskAsync() using "localhost". ✔
    Do NOT use async/await in this implementation. ✔
Implement PingProcess' async public Task<PingResult> RunAsync(string hostNameOrAddress) ✔
    First implement the public void RunAsync_UsingTaskReturn_Success() test method to test PingProcess.RunAsync() using "localhost" without using async/await. ✔
    Also implement the async public Task RunAsync_UsingTpl_Success() test method to test PingProcess.RunAsync() using "localhost" but this time DO using async/await. ✔
Add support for an optional cancellation token to the PingProcess.RunAsync() signature. ✔ Inside the PingProcess.RunAsync() invoke the token's ThrowIfCancellationRequested() method so an exception is thrown. ✔ Test that, when cancelled from the test method, the exception thrown is an AggregateException ✔ with a TaskCanceledException inner exception ✔ using the test methods RunAsync_UsingTplWithCancellation_CatchAggregateExceptionWrapping ✔and RunAsync_UsingTplWithCancellation_CatchAggregateExceptionWrappingTaskCanceledException ✔ respectively.
Complete/fix AND test async public Task<PingResult> RunAsync(IEnumerable<string> hostNameOrAddresses, CancellationToken cancellationToken = default) which executes ping for an array of hostNameOrAddresses (which can all be "localhost") in parallel, adding synchronization if needed. ❌✔ NOTE:
    The order of the items in the stdOutput is irrelevant and expected to be intermingled.
    StdOutput must have all the ping output returned (no lines can be missing) even though intermingled. ❌✔
Implement AND test public Task<int> RunLongRunningAsync(ProcessStartInfo startInfo, Action<string?>? progressOutput, Action<string?>? progressError, CancellationToken token) using Task.Factory.StartNew() and invoking RunProcessInternal with a TaskCreation value of TaskCreationOptions.LongRunning and a TaskScheduler value of TaskScheduler.Current. Returning a Task<PingResult> is also okay. NOTE: This method does NOT use Task.Run.

Extra Credit

Test and implement PingProcess.RunAsync(System.IProgress<T> progess) so that you can capture the output as it occurs rather than capturing the output only when the process finishes. ❌✔

Fundamentals

Place all shared project properties into a Directory.Build.Props file.
Place all shared project items into a Directory.Build.targets file.
Ensure nullable reference types is enabled ✔
Ensure that you turn on code analysis for all projects(EnableNETAnalyzers) ✔
Set LangVersion and the TargetFramework to the latest released versions available (preview versions optional) ✔
and enabled .NET analyzers for both projects ✔
For this assignment, consider using Assert.AreEqual<T>() (the generic version) ✔
All of the above should be unit tested ✔
Choose simplicity over complexity ✔

Seems like you guys did the " async public Task RunAsync(IEnumerable hostNameOrAddresses, CancellationToken cancellationToken = default)" without using IEnumerable, I'm not entirely sure if that's allowed so I don't know if I should mark that as correct or not. Other than that, seems like you guys need to do some modifying to tests, and then chase down all the errors to get the bot to run your program

Assignment.Tests/PingProcessTests.cs Outdated Show resolved Hide resolved
Assignment.Tests/PingProcessTests.cs Outdated Show resolved Hide resolved
Assignment.Tests/PingProcessTests.cs Outdated Show resolved Hide resolved
Assert.AreNotEqual(lineCount, numbers.Count()+1);
}

readonly string PingOutputLikeExpression = @"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be made private to get the bot to run your tests

@1Kmiller1
Copy link

Looks like Palmer got most of the changes needed for the assignment but I just wanted to add this here. its from a comment austin left on my assignment thats helping me finish step 5 of the assignment
"Here is a hint that Kevin gave. Use the Task.Factory.StartNew.

return Task.Factory.StartNew(() =>
{
// Implementation in here
}, token, TaskCreationOptions.LongRunning, TaskScheduler.Current);

Feel free to look at ours if you can't figure it out. This one was a little confusing."
([AustinH5544] (https://github.com/AustinH5544))

it's not a ton but hopefully this will help you get started on that front

@kflannery2001
Copy link

Awesome, thank you for the input!

Copy link

@KennethWhite KennethWhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you have some build issues, but other than that you checked off all the criteria!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants