public MainViewModel(IPostAppApiService _api, INavigationService _nav, UserNotificationService _not, IClosingApp _ca) { postApp = _api; navigation = _nav; notification = _not; closeApp = _ca; }
public PostaNewsEditorPageViewModel(IPostAppApiService api, INavigationService nav, LocationService _loc, UserNotificationService _not) { postApp = api; navigation = nav; location = _loc; notification = _not; }
public async Task Update_ReturnsUpdatedNotification() { string userNotificationsJson = File.ReadAllText(TestConfiguration.MockDataFolderPath + @"UserNotifications.json"); var notification = JsonConvert.DeserializeObject <List <UserNotification> >(userNotificationsJson).First(u => u.User.Id == TESTING_USER_ID); const string newTitle = "Test title"; const string newContent = "Test content"; var userNotification = new UserNotification { Id = notification.Id, Title = newTitle, Content = newContent, IsRead = true }; UserNotificationRepository.Setup(u => u.GetByKey(userNotification.Id)).Returns(notification); UserNotificationRepository.Setup(n => n.Update(notification)).ReturnsAsync(notification); var resultUserNotification = await UserNotificationService.Update(userNotification); Assert.NotNull(resultUserNotification); Assert.Equal(newTitle, resultUserNotification.Title); Assert.Equal(newContent, resultUserNotification.Content); Assert.Equal(notification.CreatedDate, resultUserNotification.CreatedDate); Assert.True(resultUserNotification.IsRead); }
public async Task Create_ReturnsNewNotification() { string usersJson = File.ReadAllText(TestConfiguration.MockDataFolderPath + @"Users.json"); var user = JsonConvert.DeserializeObject <List <User> >(usersJson).First(u => u.Id == TESTING_USER_ID); const string title = "Test title"; const string content = "Test content"; var userNotification = new UserNotification { Title = title, Content = content, IsRead = false }; UserRepository.Setup(u => u.GetByKey(TESTING_USER_ID)).Returns(user); UserNotificationRepository.Setup(n => n.Create(userNotification)).ReturnsAsync(userNotification); var resultUserNotification = await UserNotificationService.Create(userNotification); Assert.NotNull(resultUserNotification); Assert.NotNull(resultUserNotification.User); Assert.Equal(title, resultUserNotification.Title); Assert.Equal(content, resultUserNotification.Content); Assert.Equal(DateTime.Today, resultUserNotification.CreatedDate); Assert.False(resultUserNotification.IsRead); }
public static async Task InitializeAsync(AsyncPackage package, UserNotificationService userNotificationService, EnvironmentService environmentService, SolutionInfoService solutionInfoService) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new MutationConfigWindowCommand(package, commandService, userNotificationService, environmentService, solutionInfoService); }
public RegistraScuolaPageViewModel(IPostAppApiService _postApp, INavigationService navigationService, UserNotificationService _toast, ValidationService _val) { navigation = navigationService; postApp = _postApp; toast = _toast; validation = _val; ElencoCitta = postApp.GetListaComuni(); }
public RegistraEditorPageViewModel(IPostAppApiService api, INavigationService nav, UserNotificationService _t, ValidationService _validation) { postApp = api; navigation = nav; toast = _t; validation = _validation; Categorie = postApp.GetListaCategorie(); ElencoCitta = postApp.GetListaComuni(); }
public static async Task InitializeAsync(AsyncPackage package, UserNotificationService userNotificationService) { // Switch to the main thread - the call to AddCommand in MutationToolWindowCommand's constructor requires // the UI thread. await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new MutationExplorerWindowCommand(package, commandService, userNotificationService); }
private MutationExplorerWindowCommand(AsyncPackage package, OleMenuCommandService commandService, UserNotificationService userNotificationService) { _package = package ?? throw new ArgumentNullException(nameof(package)); _userNotificationService = userNotificationService; commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new MenuCommand(Execute, menuCommandID); commandService.AddCommand(menuItem); }
public void GetUnreadCount_ReturnsCount() { string userNotificationsJson = File.ReadAllText(TestConfiguration.MockDataFolderPath + @"UserNotifications.json"); var notifications = JsonConvert.DeserializeObject <List <UserNotification> >(userNotificationsJson) .Where(n => n.User.Id == TESTING_USER_ID && !n.IsRead); UserNotificationRepository.Setup(n => n.GetUnread()).Returns(notifications); int unreadNotificationsCount = UserNotificationService.GetUnreadCount(); Assert.Equal(notifications.Count(), unreadNotificationsCount); }
private SelectProjectFileCommand( AsyncPackage package, OleMenuCommandService commandService, MutationFilterItemCreatorService mutationFilterItemCreatorService, UserNotificationService userNotificationService) { _package = package ?? throw new ArgumentNullException(nameof(package)); _mutationFilterItemCreatorService = mutationFilterItemCreatorService; _userNotificationService = userNotificationService; commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new MenuCommand(Execute, menuCommandID); commandService.AddCommand(menuItem); }
private MutationConfigWindowCommand( AsyncPackage package, OleMenuCommandService commandService, UserNotificationService userNotificationService, EnvironmentService environmentService, SolutionInfoService solutionInfoService) { _package = package ?? throw new ArgumentNullException(nameof(package)); _userNotificationService = userNotificationService; _environmentService = environmentService; _solutionInfoService = solutionInfoService; commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new MenuCommand(Execute, menuCommandID); commandService.AddCommand(menuItem); }
public async Task Delete_ReturnsDeletedNotification() { string userNotificationsJson = File.ReadAllText(TestConfiguration.MockDataFolderPath + @"UserNotifications.json"); var notification = JsonConvert.DeserializeObject <List <UserNotification> >(userNotificationsJson).First(u => u.User.Id == TESTING_USER_ID); UserNotificationRepository.Setup(u => u.GetByKey(notification.Id)).Returns(notification); UserNotificationRepository.Setup(n => n.Delete(notification.Id)).ReturnsAsync(notification); var resultUserNotification = await UserNotificationService.Delete(notification.Id); Assert.NotNull(resultUserNotification); Assert.Equal(notification.Title, resultUserNotification.Title); Assert.Equal(notification.Content, resultUserNotification.Content); Assert.Equal(notification.IsRead, resultUserNotification.IsRead); Assert.Equal(notification.CreatedDate, resultUserNotification.CreatedDate); }
public UserNotificationServiceTest() { _userNotificationRepository = new Mock <IUserNotificationRepository>(); _transactionManager = new Mock <ITransactionManager>(); _systemUsageRepository = new Mock <IItSystemUsageRepository>(); _contractRepository = new Mock <IItContractRepository>(); _projectRepository = new Mock <IItProjectRepository>(); _dataProcessingRepository = new Mock <IDataProcessingRegistrationRepository>(); _operationClock = new Mock <IOperationClock>(); _logger = new Mock <ILogger>(); _sut = new UserNotificationService( _userNotificationRepository.Object, _transactionManager.Object, _systemUsageRepository.Object, _contractRepository.Object, _projectRepository.Object, _dataProcessingRepository.Object, _operationClock.Object, _logger.Object); }
public UserNotificationServiceTest() { ContextProvider = new Mock <IContextProvider>(); UserNotificationRepository = new Mock <IUserNotificationRepository>(); UserRepository = new Mock <IUserRepository>(); UserContext = new Mock <IUserContext>(); TopicEventSender = new Mock <ITopicEventSender>(); UserContext.Setup(c => c.GetUserId()).Returns(TESTING_USER_ID); ContextProvider .Setup(c => c.GetRepository <IUserNotificationRepository>()) .Returns(UserNotificationRepository.Object); ContextProvider .Setup(c => c.GetRepository <IUserRepository>()) .Returns(UserRepository.Object); UserNotificationService = new UserNotificationService( ContextProvider.Object, UserContext.Object, TopicEventSender.Object ); }
public CittaPageViewModel(IPostAppApiService _p, INavigationService _n, UserNotificationService _not) { postApp = _p; navigation = _n; notification = _not; }
public ViewEditorPageViewModel(IPostAppApiService _post, UserNotificationService _not, INavigationService _nav) { postApp = _post; notification = _not; navigation = _nav; }
public static async Task InitializeAsync(AsyncPackage package, MutationFilterItemCreatorService mutationFilterItemCreatorService, UserNotificationService userNotificationService) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new SelectProjectFileCommand(package, commandService, mutationFilterItemCreatorService, userNotificationService); }
private bool DispatchEmails(Advice advice) { var message = new MailMessage { Body = advice.Body, Subject = (advice.Subject).Replace('\r', ' ').Replace('\n', ' '), BodyEncoding = Encoding.UTF8, IsBodyHtml = true }; foreach (var r in advice.Reciepients) { switch (r.RecieverType) { case RecieverType.RECIEVER: switch (r.RecpientType) { case RecieverType.USER: AddRecipientByName(r, message.To); break; case RecieverType.ROLE: AddRecipientByRole(advice, r, message.To); break; } break; case RecieverType.CC: switch (r.RecpientType) { case RecieverType.USER: AddRecipientByName(r, message.CC); break; case RecieverType.ROLE: AddRecipientByRole(advice, r, message.CC); break; } break; } } if (message.To.Any() || message.CC.Any()) { MailClient.Send(message); advice.SentDate = OperationClock.Now; return(true); } else { var organizationIdOfRelatedEntityId = GetRelatedEntityOrganizationId(advice); if (organizationIdOfRelatedEntityId.IsNone) { Logger?.Error($"Advis doesn't have valid/correct related entity (RelationId and Type mismatch). Advice Id: {advice.Id}, Advice RelationId: {advice.RelationId}, Advice RelatedEntityType: {advice.Type}"); } else { if (advice.HasInvalidState()) { Logger?.Error($"Advis is missing critical function information. Advice Id: {advice.Id}, Advice RelationId: {advice.RelationId}, Advice RelatedEntityType: {advice.Type}, Advice ownerId: {advice.ObjectOwnerId}"); } else { var nameForNotification = advice.Name ?? "Ikke navngivet"; UserNotificationService.AddUserNotification(organizationIdOfRelatedEntityId.Value, advice.ObjectOwnerId.Value, nameForNotification, "Advis kunne ikke sendes da der ikke blev fundet nogen gyldig modtager. Dette kan skyldes at der ikke er nogen bruger tilknyttet den/de valgte rolle(r).", advice.RelationId.Value, advice.Type.Value, NotificationType.Advice); } } return(false); } }
public PostaNewsScuolaViewModel(IPostAppApiService _p, UserNotificationService notif, INavigationService nav) { api = _p; notification = notif; navigation = nav; }
public UserNotificationController(UserNotificationService userNotificationService) { _userNotificationService = userNotificationService; }