Repository navigation
Unit tests for DasBlogSettings - #728
Merged
Merged
Conversation
- Added tests for `RemoveLineBreaks`, `StripHtml`, and `StripHTMLFromText`. - Added tests for `RemoveDoubleSpaceCharacters` and `CutLongString`. - Added tests for `RemoveQuotationMarks` and `FindFirstImage`. - Added tests for `FindFirstYouTubeVideo` with and without `<iframe>`. - Improved test coverage and reliability for string extensions.
* Updated namespace from `Misc` to `ExtensionsConfig` for clarity. * Removed and re-added `StringExtensionTest` class with no logic changes. * Retained all test methods for string extension functionality. * Aligned file structure with new project organization.
* Refactored `StringExtensionTest.cs` with namespace update and formatting changes; functionality of string extension tests remains unchanged. * Added `DasBlogSettingsTests` in `DasBlogSettingsTests.cs` to test `DasBlogSettings` behavior, including `GetBaseUrl` method with mocked dependencies.
- Added new namespaces to support additional functionality. - Introduced `SiteConfig` and `List<User>` fields for testing. - Refactored test setup into a reusable `CreateSettings` method. - Replaced and expanded test cases to cover more functionality. - Enhanced test coverage for configuration options like `.aspx`. - Added edge case tests for comments, users, and HTML filtering. - Improved test assertions for more specific validation. - Simulated realistic data for user and configuration testing. - Incorporated time-based tests using `DateTime.UtcNow` and `NodaTime`. - Improved maintainability with helper methods and better structure.
- Updated `FindFirstImage` to return a tuple `(url, alt)` instead of just `src`. - Refactored `FindHeroImage` to use the new `FindFirstImage` and handle its tuple return type. - Enhanced unit tests for `FindHeroImage` and `FindFirstImage` to validate both `src` and `alt` attributes. - Added new tests for `FindFirstImage` to handle cases with and without images. - Removed outdated `FindFirstImage` implementation and its associated tests. - Improved code readability with clearer comments and better regex usage. - Fixed fallback logic in `FindHeroImage` for the new tuple return type. - Applied minor formatting improvements for consistency and clarity.
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.
PR Classification
Improved test coverage and refactored test structure for better maintainability and robustness.
PR Summary
This pull request adds comprehensive unit tests for
StringExtensionmethods and theDasBlogSettingsclass, refactors test organization, and enhances test coverage for edge cases.StringExtensionTest.cs: Added extensive unit tests for string manipulation methods and moved the class to a new namespace (DasBlog.Tests.UnitTests.Extensions).DasBlogSettingsTests.cs: Introduced a new test class with mocking for dependencies and added tests for URL generation, time zone adjustments, and admin validation.StringExtensionTestfromDasBlog.Tests.UnitTests.Misc.UseAspxExtensionandTitlePermalinkSpaceReplacement.