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

Update MessageService to implement and register as an interface #2633

Conversation

kooliokey
Copy link
Contributor

🤔 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

#2631

💡 Background and solution

Testing that an application triggers an AntDesign.Message is not currently possible because it is defined only as a concrete class. Refactoring it to be a class implementing an interface allows us to inject the interface into code and thus allows unit testing.

📝 Changelog

Language Changelog
🇺🇸 English Changed MessageCenter to be used through an interface IMessageCenter. Existing code will continue to function, but new code should inject IMessageCenter.
🇨🇳 Chinese 将 MessageCenter 更改为通过接口 IMessageCenter 使用。 现有代码将继续运行,但新代码应注入 IMessageCenter。

☑️ 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

@github-actions
Copy link

github-actions bot commented Aug 23, 2022

@dnfadmin
Copy link

dnfadmin commented Aug 23, 2022

CLA assistant check
All CLA requirements met.

@ElderJames
Copy link
Member

Thanks for contribute this @kooliokey .

@kooliokey kooliokey changed the title Update MessageCenter to implement and register as an interface Update MessageService to implement and register as an interface Aug 24, 2022
@codecov
Copy link

codecov bot commented Aug 25, 2022

Codecov Report

Merging #2633 (e7572db) into master (24216bf) will increase coverage by 1.65%.
The diff coverage is 100.00%.

❗ Current head e7572db differs from pull request most recent head d6d8228. Consider uploading reports for the commit d6d8228 to get more accurate results

@@            Coverage Diff             @@
##           master    #2633      +/-   ##
==========================================
+ Coverage   29.16%   30.82%   +1.65%     
==========================================
  Files         505      543      +38     
  Lines       34359    26420    -7939     
  Branches        0      260     +260     
==========================================
- Hits        10021     8144    -1877     
+ Misses      24338    18236    -6102     
- Partials        0       40      +40     
Impacted Files Coverage Δ
components/message/Message.razor.cs 0.00% <ø> (ø)
components/message/MessageService.cs 0.00% <ø> (ø)
...nts/core/Extensions/ServiceCollectionExtensions.cs 100.00% <100.00%> (ø)
components/core/Helpers/MemberPath/PathNode.cs 46.15% <0.00%> (-8.85%) ⬇️
components/core/Reflection/TypeDefined.cs 77.77% <0.00%> (-7.94%) ⬇️
components/input/InputGroup.razor.cs 87.50% <0.00%> (-6.95%) ⬇️
components/core/Helpers/DateHelper.cs 85.33% <0.00%> (-4.90%) ⬇️
...ponents/date-picker/types/DatePickerPlaceholder.cs 22.72% <0.00%> (-4.20%) ⬇️
...onents/date-picker/internal/DatePickerHeader.razor 41.86% <0.00%> (-3.21%) ⬇️
...ponents/core/Component/Overlay/type/TriggerType.cs 81.25% <0.00%> (-2.97%) ⬇️
... and 446 more

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

…w mocking for testing in external applications. Update documentation to use the new method of calling by injecting IMessageService.
@kooliokey kooliokey force-pushed the feature/message-service-interface branch from c9f4279 to d6d8228 Compare August 26, 2022 04:15
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 eba3f19 into ant-design-blazor:master Aug 26, 2022
@kooliokey kooliokey deleted the feature/message-service-interface branch September 3, 2022 21:38
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

3 participants