Extract interface ISerialPortStream for better testing/mocking#77
Closed
tedvanderveen wants to merge 2 commits intojcurl:v2.xfrom
Closed
Extract interface ISerialPortStream for better testing/mocking#77tedvanderveen wants to merge 2 commits intojcurl:v2.xfrom
tedvanderveen wants to merge 2 commits intojcurl:v2.xfrom
Conversation
Merge from origin
jcurl
reviewed
Nov 1, 2018
|
|
||
| void CopyTo(Stream destination); | ||
| void CopyTo(Stream destination, int bufferSize); | ||
| Task CopyToAsync(Stream destination); |
Owner
There was a problem hiding this comment.
The *Async won't compile for .NET 4.0, which I still use
jcurl
reviewed
Nov 1, 2018
| /// active that the stream can continue to read. Writes will throw an exception. | ||
| /// </remarks> | ||
| #if !NETSTANDARD15 | ||
| public new void Close() |
jcurl
pushed a commit
that referenced
this pull request
Nov 1, 2018
Having an interface allows for test code to be created without having to have an actual serial port. Just write the test code against the interface. Original Pull Request: #77 Additions to this pull request to make it compile: * Included the interface in the solution files for .NET 4.0 / 4.5; * Fix compile errors in the interface for NETFX; * Fix .NET 4.0 compatibility by not including the XXXAsync methods; * Added documentation to removing warnings when building.
Owner
|
This is now in v2.x branch after cleaning up. |
Contributor
Author
|
@jcurl can you please publish new Nuget package with this new ISerialPortStream reflected? |
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.
For UnitTests, there are no actual Com ports and connected devices available, so in an ideal world creating a Mock (using Moq for example) requires no actual implementation, just an interface to mock.