Assignment9+10 multithreading#98
Assignment9+10 multithreading#98thigiang16 wants to merge 35 commits intoIntelliTect-Samples:Assignment9+10-Multithreadingfrom
Conversation
katmilton
left a comment
There was a problem hiding this comment.
Implement PingProcess' public Task 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 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 RunAsync(IEnumerable 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 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 is also okay. NOTE: This method does NOT use Task.Run.✔
Extra Credit
Test and implement PingProcess.RunAsync(System.IProgress 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() (the generic version) ✔
All of the above should be unit tested ✔
Choose simplicity over complexity ✔
Good work!
Al3xramirez
left a comment
There was a problem hiding this comment.
Implement PingProcess' public Task 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 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 RunAsync(IEnumerable 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 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 is also okay. NOTE: This method does NOT use Task.Run.
Extra Credit
Test and implement PingProcess.RunAsync(System.IProgress progess) so that you can capture the output as it occurs rather than capturing the output only when the process finishes. ❌ (Missing testing)
Fundamentals
Place all shared project properties into a Directory.Build.Props file. ✔
Place all shared project items into a Directory.Build.targets file. ❌ (Don't think you need this file but wouldnt hurt to add it!)
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() (the generic version) ✔
All of the above should be unit tested ✔
Choose simplicity over complexity ✔
|
Implement PingProcess' public Task RunTaskAsync(string hostNameOrAddress) ✔ Extra Credit Test and implement PingProcess.RunAsync(System.IProgress 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. Awesome. |
ColtonKnopik
left a comment
There was a problem hiding this comment.
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.
Good job
|
Implement PingProcess' public Task RunTaskAsync(string hostNameOrAddress) ✔ Extra Credit Fundamentals |
SummarySummary
CoverageAssignment - 50.6%
|
Joshua-Lester3
left a comment
There was a problem hiding this comment.
Instructions
- Implement
PingProcess'public Task<PingResult> RunTaskAsync(string hostNameOrAddress)✔- First implement
public void RunTaskAsync_Success()test method to testPingProcess.RunTaskAsync()using"localhost". ✔ - Do NOT use async/await in this implementation. ✔
- First implement
- Implement
PingProcess'async public Task<PingResult> RunAsync(string hostNameOrAddress)✔- First implement the
public void RunAsync_UsingTaskReturn_Success()test method to testPingProcess.RunAsync()using"localhost"without using async/await. ✔ - Also implement the
async public Task RunAsync_UsingTpl_Success()test method to testPingProcess.RunAsync()using"localhost"but this time DO using async/await. ✔
- First implement the
- Add support for an optional cancellation token to the
PingProcess.RunAsync()signature. ✔
Inside thePingProcess.RunAsync()invoke the token'sThrowIfCancellationRequested()method so an exception is thrown. ✔
Test that, when cancelled from the test method, the exception thrown is anAggregateException✔ with aTaskCanceledExceptioninner exception ✔ using the test methodsRunAsync_UsingTplWithCancellation_CatchAggregateExceptionWrapping✔andRunAsync_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)usingTask.Factory.StartNew()and invokingRunProcessInternalwith aTaskCreationvalue ofTaskCreationOptions.LongRunningand aTaskSchedulervalue ofTaskScheduler.Current. Returning aTask<PingResult>is also okay.
NOTE: This method does NOT useTask.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.Propsfile. - Place all shared project items into a
Directory.Build.targetsfile. - Ensure nullable reference types is enabled ✔
- Ensure that you turn on code analysis for all projects(EnableNETAnalyzers) ✔
- Set
LangVersionand theTargetFrameworkto 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 ✔
Looks good!
worked with @ulises-aguilar. We implemented the extra credit in this PR