private static async Task <SubscriptionResponse> GetSubscriptionResponse(User user) { var messages = new List <SyncMessageBase>(); var mockConnection = new Mock <ISyncConnection>(); mockConnection .Setup(x => x.SendJsonAsync(It.IsAny <object>())) .Returns((object obj) => { Assert.IsInstanceOf <SyncMessageBase>(obj); messages.Add((SyncMessageBase)obj); return(Task.CompletedTask); }); var principal = new ShipHubPrincipal(user.Id, user.Login); var syncContext = new SyncContext(principal, mockConnection.Object, new SyncVersions()); var changeSummary = new ChangeSummary(); changeSummary.Add(userId: user.Id); await syncContext.Sync(changeSummary); var result = messages .Where(x => x.MessageType.Equals("subscription")) .SingleOrDefault(); Assert.IsNotNull(result, "Should have been sent a SubscriptionEntry."); return((SubscriptionResponse)result); }
public SyncConnection(ShipHubPrincipal user, ISyncManager syncManager, IAsyncGrainFactory grainFactory) : base(_MaxMessageSize) { _user = user; _syncManager = syncManager; _grainFactory = grainFactory; }
public SyncContext(ShipHubPrincipal user, ISyncConnection connection, SyncVersions initialVersions) { _user = user; _connection = connection; _versions = initialVersions; _selectiveSyncEnabled = connection.ClientBuild >= MinimumSelectiveSyncVersion; _querySyncEnabled = connection.ClientBuild >= MinimumQueriesClientVersion; RunUpgradeCheck(); }