diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 893b793eefa..6a241dfeff2 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.4.7-beta04 + 9.4.7 diff --git a/src/BootstrapBlazor/Services/BootstrapBlazorRootRegisterService.cs b/src/BootstrapBlazor/Services/BootstrapBlazorRootRegisterService.cs index 8c6bf5f0048..17437922b5a 100644 --- a/src/BootstrapBlazor/Services/BootstrapBlazorRootRegisterService.cs +++ b/src/BootstrapBlazor/Services/BootstrapBlazorRootRegisterService.cs @@ -14,7 +14,7 @@ public class BootstrapBlazorRootRegisterService private readonly Dictionary> _providersByIdentifier = []; /// - /// add provider + /// Add provider /// /// /// @@ -30,7 +30,7 @@ public void AddProvider(object identifier, BootstrapBlazorRootContent provider) } /// - /// remove provider + /// Remove provider /// /// /// @@ -58,7 +58,7 @@ public void RemoveProvider(object identifier, BootstrapBlazorRootContent provide } /// - /// get all providers by identifier + /// Get all providers by identifier /// /// /// @@ -69,7 +69,7 @@ public List GetProviders(object identifier) } /// - /// subscribe + /// Subscribe /// /// /// @@ -77,22 +77,19 @@ public void Subscribe(object identifier, BootstrapBlazorRootOutlet subscriber) { if (_subscribersByIdentifier.ContainsKey(identifier)) { - throw new InvalidOperationException($"There is already a subscriber to the content with the given root ID '{identifier}'."); + return; } _subscribersByIdentifier.Add(identifier, subscriber); } /// - /// 取消订阅 + /// Unsubscribe /// /// public void Unsubscribe(object identifier) { - if (!_subscribersByIdentifier.Remove(identifier)) - { - throw new InvalidOperationException($"The subscriber with the given root ID '{identifier}' is already unsubscribed."); - } + _subscribersByIdentifier.Remove(identifier); } /// diff --git a/test/UnitTest/Services/BootstrapBlazorRootRegisterServiceTest.cs b/test/UnitTest/Services/BootstrapBlazorRootRegisterServiceTest.cs index 59dabbf2377..a8c6b900b17 100644 --- a/test/UnitTest/Services/BootstrapBlazorRootRegisterServiceTest.cs +++ b/test/UnitTest/Services/BootstrapBlazorRootRegisterServiceTest.cs @@ -28,11 +28,7 @@ public void Subscribe_Ok() var service = new BootstrapBlazorRootRegisterService(); var identifier = new object(); service.Subscribe(identifier, new BootstrapBlazorRootOutlet()); - var exception = Assert.ThrowsAny(() => service.Subscribe(identifier, new BootstrapBlazorRootOutlet())); - Assert.Equal("There is already a subscriber to the content with the given root ID 'System.Object'.", exception.Message); - - exception = Assert.ThrowsAny(() => service.Unsubscribe(new object())); - Assert.Equal("The subscriber with the given root ID 'System.Object' is already unsubscribed.", exception.Message); + service.Unsubscribe(new object()); } [Fact]