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
Update InternalSDKUTils.DetermineFramework to return standard string … #3302
Conversation
/// An interface for <see cref="RuntimeInformationWrapper"/> which allows for mocking the <see cref="RuntimeInformation"/> class. | ||
/// A wrapper is necessary because the class is static. | ||
/// </summary> | ||
internal interface IRuntimeInformationWrapper |
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.
Does this interface need to be marked internal
? It's already in the Internal
namespace, and in my opinion made this PR much more complicated than necessary.
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.
Norm asked me to make these internal and utilize InternalsVisibleTo
😅.
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'm fine with either approach. My intention was I wanted the new interface to be treated as internal. Probably not a bad thing to get our unit tests project setup to access internals for future testing.
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 agree it's not a bad thing to have it set up so that we can use it in the future.
sdk/src/Core/Amazon.Util/Internal/_netstandard/InternalSDKUtils.netstandard.cs
Outdated
Show resolved
Hide resolved
/// An interface for <see cref="RuntimeInformationWrapper"/> which allows for mocking the <see cref="RuntimeInformation"/> class. | ||
/// A wrapper is necessary because the class is static. | ||
/// </summary> | ||
internal interface IRuntimeInformationWrapper |
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'm fine with either approach. My intention was I wanted the new interface to be treated as internal. Probably not a bad thing to get our unit tests project setup to access internals for future testing.
sdk/test/NetStandard/UnitTests/AWSSDK.UnitTests.Custom.NetStandard.csproj
Show resolved
Hide resolved
…and additional metadata if version parsing fails
3a2e7ac
to
21a28bc
Compare
…and additional metadata if version parsing fails
Description
This updates the
DetermineFramework
method, which previously could return junk like "1-10-2023" or whatever was returned fromGetValidSubstringOrUnknown
. This is because people can build their own custom version ofSystem.Runtime.InteropServices.RuntimeInformation.dll
.In these cases, where the version is not in the standard format i.e.
n.n.n
, we now return a consistent string.In order to mock the
DetermineFramework
method, I had to mock the staticRuntimeInformation
class. This class doesn't implement and interface so I had to create an interface and a wrapper to allow me to inject the mocked version ofRuntimeInformation
.Motivation and Context
Internal Ticket 7368
Testing
Added Unit Tests
Dry run passes
Screenshots (if appropriate)
Types of changes
Checklist
License