Skip to content
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

refactor(notification): update NotificationService to use interface #2948

Conversation

wss-javeney
Copy link
Contributor

@wss-javeney wss-javeney commented Dec 15, 2022

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

It is not possible to test that an application triggered an AntDesign.Notification currently due to it being a concrete class. This refactors it into a class that implements an interface. Users can use dependency injection now and unit test that the code triggered notifications to show.

📝 Changelog

Language Changelog
🇺🇸 English Changed NotificationService to be used through an interface INotificationService. It is backwards compatible, but new code should inject INotificationService.
🇨🇳 Chinese 更改了通過接口 INotificationService 使用的 NotificationService。它是向後兼容的,但新代碼應該注入 INotificationService。

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

@pr-triage pr-triage bot added the PR: draft label Dec 15, 2022
@github-actions
Copy link

github-actions bot commented Dec 15, 2022

@wss-javeney wss-javeney marked this pull request as ready for review December 15, 2022 17:59
@codecov
Copy link

codecov bot commented Dec 15, 2022

Codecov Report

Base: 43.57% // Head: 45.03% // Increases project coverage by +1.46% 🎉

Coverage data is based on head (0074856) compared to base (b4e7750).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2948      +/-   ##
==========================================
+ Coverage   43.57%   45.03%   +1.46%     
==========================================
  Files         551      551              
  Lines       25936    25933       -3     
  Branches      263      263              
==========================================
+ Hits        11302    11680     +378     
+ Misses      14594    14213     -381     
  Partials       40       40              
Impacted Files Coverage Δ
components/notification/NotificationService.cs 0.00% <ø> (ø)
...nts/core/Extensions/ServiceCollectionExtensions.cs 100.00% <100.00%> (ø)
components/select/Select.razor.cs 53.24% <0.00%> (+0.26%) ⬆️
components/select/SelectBase.cs 71.19% <0.00%> (+0.27%) ⬆️
components/input/Input.cs 69.23% <0.00%> (+0.34%) ⬆️
components/date-picker/internal/DatePickerBase.cs 79.01% <0.00%> (+0.66%) ⬆️
components/core/CssSizeLength.cs 86.07% <0.00%> (+1.07%) ⬆️
components/grid/Col.razor.cs 96.00% <0.00%> (+1.33%) ⬆️
components/core/Extensions/JSRuntimeExtensions.cs 53.33% <0.00%> (+3.33%) ⬆️
components/grid/Row.razor.cs 84.44% <0.00%> (+8.88%) ⬆️
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ElderJames
Copy link
Member

Please show how to add a test with Notification, just add it in the test project.

Copy link
Member

@ElderJames ElderJames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ElderJames ElderJames merged commit 9067a68 into ant-design-blazor:master Dec 29, 2022
kooliokey pushed a commit to kooliokey/ant-design-blazor that referenced this pull request Jan 15, 2023
…erface (ant-design-blazor#2948)

* refactor(notification): update NotificationService to use interface

* Add example unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants