Observer DI#34
Merged
Merged
Conversation
Refactored request creation into CreateJsonRequest for consistency. Added PostAsync, PutAsync, and DeleteAsync methods to both the client and its interface, with proper serialization and ETag handling. Expanded XML docs for new methods. Added unit tests for new operations, covering success and error cases.
Changed CreateJsonRequest from an instance to a static method in BusinessCentralClient, allowing it to be called without requiring an object instance. This improves clarity and usage for methods that do not depend on instance state.
Updated the project version in Dynamics365.BusinessCentral.csproj from 0.1.10 to 1.0.0-alpha, marking the transition to a new major version and indicating an alpha release. No other changes were made.
Refactor BusinessCentralOptions registration to use a singleton instance instead of IOptions. Update BusinessCentralClient registration to use a factory, allowing injection of an optional IBusinessCentralObserver. Add AddBusinessCentralObserver<TObserver> extension method for registering custom observer implementations. These changes improve flexibility and diagnostics extensibility.
Renamed AddBusinessCentralObserver<T> to AddObserver<T> for clarity and removed its XML doc comment. Moved test utility classes to a new Utils namespace to better separate test helpers from test cases. Updated usings accordingly. Added ServiceCollectionExtensionsTests to verify DI registration of the client and observer. Made minor comment and formatting improvements in ServiceCollectionExtensions.
Added a using directive for Dynamics365.BusinessCentral.Tests.Utils to ClientTests.cs to enable access to utility classes and methods from the Tests.Utils namespace. No other changes were made.
Added BusinessCentralClient_Factory_Executes_Without_Observer unit test to ensure IBusinessCentralClient can be resolved from the service provider when registered without an observer. The test verifies correct registration and configuration.
Refactored ServiceCollectionExtensionsTests for improved clarity and coverage. Centralized default options setup, renamed and reorganized tests for better intent, added new tests for observer and options registration, and removed obsolete tests. Simplified TestObserver and cleaned up usings. Tests are now more focused, DRY, and provide better verification of DI service and options registration.
Annotated ServiceCollectionExtensions with [ExcludeFromCodeCoverage] to exclude it from code coverage analysis. Imported System.Diagnostics.CodeAnalysis to support this attribute. No functional changes were made.
|
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.



Added Observer DI support