Lab 3: unit tests and coverage reporting#20
Open
nik-bykoff wants to merge 3 commits intolenagrin:masterfrom
Open
Lab 3: unit tests and coverage reporting#20nik-bykoff wants to merge 3 commits intolenagrin:masterfrom
nik-bykoff wants to merge 3 commits intolenagrin:masterfrom
Conversation
- Move SONAR_PROJECT_KEY/SONAR_ORGANIZATION into workflow env block with explicit setup instructions for fork-based usage. - Update README with student header, fork/upstream links and a table of all eight lab reports. - Replace SonarCloud badges with placeholders for nik-bykoff fork. - Add docs/labs/lab-01.md report describing manual SonarCloud steps, CI workflow layout and verification checklist. - Ignore local .env files to prevent accidental token leaks.
- Rename NetSdrClient.Disconect to Disconnect (typo) and update callers/tests. - Remove stray semicolon in StartIQAsync and unused JSType using-statics. - Make responseTaskSource thread-safe via Interlocked.Exchange + TrySetResult. - Replace Aggregate-on-empty-may-throw log formatting with string.Join in three places. - Rewrite GetSamples from O(n^2) IEnumerable.Count loop to O(n) for-loop with reusable byte[4] buffer. - Replace MD5-based UdpClientWrapper.GetHashCode with HashCode.Combine and add Equals override. - Make TcpClientWrapper._cts nullable, mark _host/_port readonly, drop unused exception variable names. - All eight existing unit tests still pass; compiler warnings dropped from 18 to 15 (rest are EchoTcpServer or NuGet).
- Add coverlet.msbuild to NetSdrClientAppTests with PrivateAssets=all. - Add four NetSdrClient tests (ChangeFrequency, idempotent IQ flag, listener startup, no-op when disconnected). - Add six NetSdrMessageHelper tests covering control-item/data-item roundtrip and GetSamples edge cases (8/16 bit, empty body, oversized width). - Fix latent bug in TranslateMessage where Enum.IsDefined was called with ushort while ControlItemCodes underlying type is int. - Re-enable Tests with coverage step in CI workflow with opencover output and Program exclusion. - 18/18 tests passing locally; coverage of NetSdrClientApp module: line 45.86%, branch 26.92%, method 48.48%.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Wire OpenCover-format coverage into CI and grow the test suite from 8 to 18 tests.
coverlet.msbuild6.0.0 toNetSdrClientAppTests(withPrivateAssets=all).NetSdrClienttests coveringChangeFrequencyAsync, idempotentIQStartedtoggling, listener startup, and no-op-when-disconnected.NetSdrMessageHelpertests covering control-item/data-item roundtrip andGetSamplesedges (8 bit, 16 bit, empty body, oversized 40-bit width).TranslateMessage:Enum.IsDefinedwas called with aushortwhileControlItemCodesunderlying type isint, throwingArgumentException. Cast added:(int)value.Tests with coverage (OpenCover)step in.github/workflows/sonarcloud.yml, excludingProgramfrom coverage.Numbers
Local run on
lab-03-tests-coverage:NetSdrClientApp)TcpClientWrapperandUdpClientWrapperkeep coverage low because they bind real OS sockets; their testability refactor is scheduled for Lab 6.Test plan
dotnet test NetSdrClient.sln -c Releasereports 18/18 passing.dotnet test ... /p:CollectCoverage=true /p:CoverletOutputFormat=opencoverproducesTestResults/coverage.xml.Discipline / Author