public NotificationMessageServiceUnitTests() { _repositoryMock = new Mock <INotificationRepository>(); Func <INotificationRepository> factory = () => _repositoryMock.Object; _mockUnitOfWork = new Mock <IUnitOfWork>(); _repositoryMock.Setup(ss => ss.UnitOfWork).Returns(_mockUnitOfWork.Object); _eventPublisherMock = new Mock <IEventPublisher>(); _notificationServiceMock = new Mock <INotificationService>(); _notificationMessageService = new NotificationMessageService(factory, _eventPublisherMock.Object, _notificationServiceMock.Object); if (!AbstractTypeFactory <NotificationMessageEntity> .AllTypeInfos.SelectMany(x => x.AllSubclasses).Contains(typeof(EmailNotificationMessageEntity))) { AbstractTypeFactory <NotificationMessageEntity> .RegisterType <EmailNotificationMessageEntity>(); } if (!AbstractTypeFactory <NotificationTemplate> .AllTypeInfos.SelectMany(x => x.AllSubclasses).Contains(typeof(EmailNotificationTemplate))) { AbstractTypeFactory <NotificationTemplate> .RegisterType <EmailNotificationTemplate>().MapToType <NotificationTemplateEntity>(); } if (!AbstractTypeFactory <NotificationMessage> .AllTypeInfos.SelectMany(x => x.AllSubclasses).Contains(typeof(EmailNotificationMessage))) { AbstractTypeFactory <NotificationMessage> .RegisterType <EmailNotificationMessage>().MapToType <NotificationMessageEntity>(); } var notificationService = new NotificationService(null, null); notificationService.RegisterNotification <RegistrationEmailNotification>(); }
public NotificationMessageServiceUnitTests() { _repositoryMock = new Mock <INotificationRepository>(); Func <INotificationRepository> factory = () => _repositoryMock.Object; _mockUnitOfWork = new Mock <IUnitOfWork>(); _repositoryMock.Setup(ss => ss.UnitOfWork).Returns(_mockUnitOfWork.Object); _eventPublisherMock = new Mock <IEventPublisher>(); _notificationMessageService = new NotificationMessageService(factory, _eventPublisherMock.Object); //todo if (!AbstractTypeFactory <Notification> .AllTypeInfos.Any(t => t.IsAssignableTo(nameof(EmailNotification)))) { AbstractTypeFactory <Notification> .RegisterType <EmailNotification>().MapToType <NotificationEntity>(); } 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>(); } }
public NotificationMessageServiceUnitTests() { _repositoryMock = new Mock <INotificationRepository>(); Func <INotificationRepository> factory = () => _repositoryMock.Object; _mockUnitOfWork = new Mock <IUnitOfWork>(); _repositoryMock.Setup(ss => ss.UnitOfWork).Returns(_mockUnitOfWork.Object); _eventPublisherMock = new Mock <IEventPublisher>(); _notificationServiceMock = new Mock <INotificationService>(); _notificationSearchServiceMock = new Mock <INotificationSearchService>(); _notificationMessageService = new NotificationMessageService(factory, _eventPublisherMock.Object); if (!AbstractTypeFactory <NotificationMessageEntity> .AllTypeInfos.SelectMany(x => x.AllSubclasses).Contains(typeof(EmailNotificationMessageEntity))) { AbstractTypeFactory <NotificationMessageEntity> .RegisterType <EmailNotificationMessageEntity>(); } if (!AbstractTypeFactory <NotificationTemplate> .AllTypeInfos.SelectMany(x => x.AllSubclasses).Contains(typeof(EmailNotificationTemplate))) { AbstractTypeFactory <NotificationTemplate> .RegisterType <EmailNotificationTemplate>().MapToType <NotificationTemplateEntity>(); } if (!AbstractTypeFactory <NotificationMessage> .AllTypeInfos.SelectMany(x => x.AllSubclasses).Contains(typeof(EmailNotificationMessage))) { AbstractTypeFactory <NotificationMessage> .RegisterType <EmailNotificationMessage>().MapToType <NotificationMessageEntity>(); } var criteria = AbstractTypeFactory <NotificationSearchCriteria> .TryCreateInstance(); criteria.NotificationType = nameof(RegistrationEmailNotification); criteria.Take = 1; _notificationSearchServiceMock.Setup(x => x.SearchNotificationsAsync(criteria)).ReturnsAsync(new NotificationSearchResult()); var notificationService = new NotificationRegistrar(null); notificationService.RegisterNotification <RegistrationEmailNotification>(); }
/// <summary> /// Initializes a new instance of the <see cref="NotificationsApiController"/> class. /// </summary> /// <param name="merchelloContext"> /// The merchello Context. /// </param> /// <param name="umbracoContext"> /// The umbraco Context. /// </param> internal NotificationsApiController(MerchelloContext merchelloContext, UmbracoContext umbracoContext) : base(merchelloContext, umbracoContext) { _notificationMessageService = ((ServiceContext)MerchelloContext.Services).NotificationMessageService as NotificationMessageService; }
/// <summary> /// Initializes a new instance of the <see cref="NotificationsApiController"/> class. /// </summary> /// <param name="merchelloContext">The merchello context</param> public NotificationsApiController(MerchelloContext merchelloContext) : base(merchelloContext) { _notificationMessageService = ((ServiceContext)MerchelloContext.Services).NotificationMessageService as NotificationMessageService; }
public NotificationMessagesServiceTests() { _service = new NotificationMessageService(_notificationMessageRepositoryMock.Object, EmptyLogFactory.Instance, _encryptionServiceMock.Object); }