private void UpdateChange(object sender, SqlNotificationEventArgs e) { if (e.Type == SqlNotificationType.Change) { MonitorHub.Send("Dependency", "UpdateChange"); } SubscribeDatabaseChange(); }
public MonitorHubTests() { _mockClientProxy = new Mock <IClientProxy>(); _mockClients = new Mock <IHubCallerClients>(); _mockGroupManager = new Mock <IGroupManager>(); _mockHubCallerContext = new Mock <HubCallerContext>(); _mockHubCallerContext.Setup(x => x.ConnectionId).Returns(connectionId); _mockHubCallerContext.Setup(x => x.User) .Returns(() => { var identity = new ClaimsIdentity( "OAuth", ClaimTypes.UserNameType, ClaimTypes.RoleType); identity.AddClaim(new Claim(ClaimTypes.AccountIdType, groupName.ToString())); identity.AddClaim(new Claim(ClaimTypes.AccountDescriptionType, "Test")); identity.AddClaim(new Claim(ClaimTypes.UserNameType, userName)); identity.AddClaim(new Claim(ClaimTypes.UserIdType, userId.ToString())); return(new ClaimsPrincipal(identity)); }); _mockClients.Setup(x => x.All) .Returns(_mockClientProxy.Object); _mockClients.Setup(x => x.OthersInGroup(groupName.ToString())) .Returns(_mockClientProxy.Object); _monitorHub = new MonitorHub( new Mock <ILogger <MonitorHub> >().Object) { Clients = _mockClients.Object, Context = _mockHubCallerContext.Object, Groups = _mockGroupManager.Object }; }
private void dep_OnChange(object sender, SqlNotificationEventArgs e) { MonitorHub.Show(); //this.SqlTableDependency.Stop(); //throw new NotImplementedException(); }