-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using LeanCode.Contracts; | ||
|
||
namespace LeanPipe.TestClient; | ||
|
||
public class LeanPipeSubscription | ||
{ | ||
private readonly List<object> receivedNotifications = new(); | ||
|
||
public ITopic Topic { get; private init; } | ||
public Guid? SubscriptionId { get; private set; } | ||
public IReadOnlyList<object> ReceivedNotifications => receivedNotifications; | ||
|
||
public LeanPipeSubscription(ITopic topic, Guid? subscriptionId) | ||
{ | ||
Topic = topic; | ||
SubscriptionId = subscriptionId; | ||
} | ||
|
||
public void Subscribe(Guid subscriptionId) | ||
{ | ||
SubscriptionId = subscriptionId; | ||
} | ||
|
||
public void Unsubscribe() | ||
{ | ||
SubscriptionId = null; | ||
} | ||
|
||
public void AddNotification(object notification) | ||
{ | ||
receivedNotifications.Add(notification); | ||
} | ||
} |
This file contains 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
This file contains 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