Add comprehensive unit tests for API request classes#37
Merged
Conversation
Add comprehensive tests for all request classes covering endpoint configuration, HTTP method, key/parameter assignment, URI building, query string parameters, and serialized content verification. Tests added for: DeleteMonitor, GetMonitor, ListMonitor, ListActivities, ListAlerts, ListPings, UpdateMonitor, PauseMonitor, UnpauseMonitor, CreateNotification, DeleteNotification, GetNotification, ListNotification, UpdateNotification, CreateIssue, GetIssue, ListIssue, and UpdateIssue requests. https://claude.ai/code/session_01YCX6eYsEce6y9hqANb9F7F
Add missing "created":"0001-01-01T00:00:00" to Issue and Notification JSON test data files. Unlike Monitor.CreatedAt (protected set, excluded by IgnoreReadOnlyProperties), Issue.CreatedAt and Template.CreatedAt have public setters and DateTime is a non-nullable value type, so they are always serialized. Remove unused System.Net.Http imports from PauseMonitorRequestTests and UnpauseMonitorRequestTests. https://claude.ai/code/session_01YCX6eYsEce6y9hqANb9F7F
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
This PR adds comprehensive unit test coverage for all API request classes in the Cronitor SDK, including tests for monitors, notifications, issues, and various operations like pause/unpause, list, get, create, update, and delete.
Key Changes
Request Tests Added: Created 18 new test classes covering:
GetMonitorRequest,ListMonitorRequest,UpdateMonitorRequest,DeleteMonitorRequest,PauseMonitorRequest,UnpauseMonitorRequestListActivitiesRequest,ListAlertsRequest,ListPingsRequestGetNotificationRequest,ListNotificationRequest,CreateNotificationRequest,UpdateNotificationRequest,DeleteNotificationRequestGetIssueRequest,ListIssueRequest,CreateIssueRequest,UpdateIssueRequestTest Coverage: Each request class is tested for:
Test Data Files: Added JSON fixture files for request body validation:
UpdateMonitorRequest.jsonCreateNotificationRequest.jsonUpdateNotificationRequest.jsonCreateIssueRequest.jsonUpdateIssueRequest.jsonNotable Implementation Details
[JsonData]attribute with fixture files to validate serialized request bodies#if NET8_0_OR_GREATER) handles async string reading differences between .NET versions:key→ actual key value)