public NotificationsExportImportManagerIntegrationTests() { _repositoryMock = new Mock <INotificationRepository>(); _eventPulisherMock = new Mock <IEventPublisher>(); INotificationRepository RepositoryFactory() => _repositoryMock.Object; _mockUnitOfWork = new Mock <IUnitOfWork>(); _repositoryMock.Setup(ss => ss.UnitOfWork).Returns(_mockUnitOfWork.Object); _notificationSearchService = new NotificationSearchService(RepositoryFactory); _notificationService = new NotificationService(RepositoryFactory, _eventPulisherMock.Object); _notificationsExportImportManager = new NotificationsExportImportManager(_notificationSearchService, _notificationService); _notificationRegistrar = new NotificationService(RepositoryFactory, _eventPulisherMock.Object); if (!AbstractTypeFactory <Notification> .AllTypeInfos.Any(t => t.IsAssignableTo(nameof(EmailNotification)))) { AbstractTypeFactory <Notification> .RegisterType <EmailNotification>().MapToType <NotificationEntity>(); AbstractTypeFactory <NotificationEntity> .RegisterType <EmailNotificationEntity>(); } if (!AbstractTypeFactory <NotificationTemplate> .AllTypeInfos.Any(t => t.IsAssignableTo(nameof(EmailNotificationTemplate)))) { AbstractTypeFactory <NotificationTemplate> .RegisterType <EmailNotificationTemplate>().MapToType <NotificationTemplateEntity>(); } if (!AbstractTypeFactory <NotificationMessage> .AllTypeInfos.Any(t => t.IsAssignableTo(nameof(EmailNotificationMessage)))) { AbstractTypeFactory <NotificationMessage> .RegisterType <EmailNotificationMessage>().MapToType <NotificationMessageEntity>(); } _notificationRegistrar.RegisterNotification <RegistrationEmailNotification>(); }
public NotificationSearchServiceUnitTests() { _repositoryMock = new Mock <INotificationRepository>(); _repositoryFactoryMock = new Mock <Func <INotificationRepository> >(); _eventPublisherMock = new Mock <IEventPublisher>(); _notificationRegistrar = new NotificationService(_repositoryFactoryMock.Object, _eventPublisherMock.Object); _repositoryFactory = () => _repositoryMock.Object; _notificationSearchService = new NotificationSearchService(_repositoryFactory); }
public SocialNetworkNotificationEntityUnitTests() { _repositoryMock = new Mock <INotificationRepository>(); _repositoryFactory = () => _repositoryMock.Object; _mockUnitOfWork = new Mock <IUnitOfWork>(); _repositoryMock.Setup(ss => ss.UnitOfWork).Returns(_mockUnitOfWork.Object); _eventPublisherMock = new Mock <IEventPublisher>(); _notificationService = new NotificationService(_repositoryFactory, _eventPublisherMock.Object); _notificationRegistrar = _notificationService; _notificationServiceMock = new Mock <INotificationService>(); _notificationSearchService = new NotificationSearchService(_repositoryFactory, _notificationServiceMock.Object); if (!AbstractTypeFactory <NotificationEntity> .AllTypeInfos.SelectMany(x => x.AllSubclasses).Contains(typeof(SocialNetworkNotificationEntity))) { AbstractTypeFactory <NotificationEntity> .RegisterType <SocialNetworkNotificationEntity>(); } }
public NotificationSearchServiceUnitTests() { _repositoryMock = new Mock <INotificationRepository>(); _repositoryFactoryMock = new Mock <Func <INotificationRepository> >(); _eventPublisherMock = new Mock <IEventPublisher>(); _repositoryFactory = () => _repositoryMock.Object; _notificationServiceMock = new Mock <INotificationService>(); _notificationSearchServiceMock = new Mock <INotificationSearchService>(); _memCache = GetCache(); _cacheEntryMock = new Mock <ICacheEntry>(); _notificationRegistrar = new NotificationRegistrar(null); _notificationSearchService = new NotificationSearchService(_repositoryFactory, _notificationServiceMock.Object, _memCache); var criteria = AbstractTypeFactory <NotificationSearchCriteria> .TryCreateInstance(); criteria.Take = 1; criteria.NotificationType = nameof(InvoiceEmailNotification); _notificationSearchServiceMock.Setup(x => x.SearchNotificationsAsync(criteria)).ReturnsAsync(new NotificationSearchResult()); _notificationRegistrar.RegisterNotification <InvoiceEmailNotification>(); criteria.NotificationType = nameof(OrderSentEmailNotification); _notificationSearchServiceMock.Setup(x => x.SearchNotificationsAsync(criteria)).ReturnsAsync(new NotificationSearchResult()); _notificationRegistrar.RegisterNotification <OrderSentEmailNotification>(); criteria.NotificationType = nameof(OrderPaidEmailNotification); _notificationSearchServiceMock.Setup(x => x.SearchNotificationsAsync(criteria)).ReturnsAsync(new NotificationSearchResult()); _notificationRegistrar.RegisterNotification <OrderPaidEmailNotification>(); criteria.NotificationType = nameof(RemindUserNameEmailNotification); _notificationSearchServiceMock.Setup(x => x.SearchNotificationsAsync(criteria)).ReturnsAsync(new NotificationSearchResult()); _notificationRegistrar.RegisterNotification <RemindUserNameEmailNotification>(); criteria.NotificationType = nameof(RegistrationEmailNotification); _notificationSearchServiceMock.Setup(x => x.SearchNotificationsAsync(criteria)).ReturnsAsync(new NotificationSearchResult()); _notificationRegistrar.RegisterNotification <RegistrationEmailNotification>(); }