public async Task Add_user_Notification_success() { //Arrange var model = new NotificationEventModel { Data = new NotificationData { AppointmentDateTime = "23/01/2020", FirstName = "Romio", OrganisationName = "Little Runners", Reason = "Healthy" }, Type = "AppointmentCancelled", UserId = Guid.NewGuid() }; //Act var catalogContext = new NotificationsDbContext(_dbOptions); var accessServ = new NotificationsAccess(catalogContext); var NotificationServ = new NotificationsService(accessServ); var testController = new NotificationsController(NotificationServ); var actionResult = await testController.AddUserNotification(model).ConfigureAwait(false); //Assert Assert.IsType <OkObjectResult>(actionResult); var result = Assert.IsAssignableFrom <NotificationModel>(((OkObjectResult)actionResult).Value); Assert.Contains("Healthy", result.Message); }
public NotificationsDbContextCleaner( NotificationsDbContext context, IWebHostEnvironment environment, ILogger <NotificationsDbContextCleaner> logger ) : base(context, environment, logger) { Users = context.Set <User>(); }
public MyNotifications( UserContext userContext, NotificationsDbContext notificationsDbContext, NotificationManagerRegister notificationManagerRegister) { this.userContext = userContext; this.notificationsDbContext = notificationsDbContext; this.notificationManagerRegister = notificationManagerRegister; }
public CloseMagic(CoreDbContext context, EmailTemplateRegister emailSender, NotificationsDbContext notificationsDbContext, IOptions <AppConfig> appConfig) { this.context = context; this.emailSender = emailSender; this.notificationsDbContext = notificationsDbContext; this.appConfig = appConfig; }
public SubmitMagic(CoreDbContext context, EmailTemplateRegister emailSender, NotificationsDbContext notificationsDbContext, IOptions <AppConfig> appConfig, UserManager <ApplicationUser> userManager) { this.context = context; this.emailSender = emailSender; this.notificationsDbContext = notificationsDbContext; this.appConfig = appConfig; this.userManager = userManager; }
public OnWorkItemAssigned( EventManager manager, EmailTemplateRegister emailSender, CoreDbContext dbContext, IOptions <AppConfig> appConfig, NotificationsDbContext notificationsDbContext) : base(manager) { this.emailSender = emailSender; this.dbContext = dbContext; this.appConfig = appConfig; this.notificationsDbContext = notificationsDbContext; }
public NotificationControllerTest() { _dbOptions = new DbContextOptionsBuilder <NotificationsDbContext>() .UseInMemoryDatabase(databaseName: "in-memory") .Options; using (var dbContext = new NotificationsDbContext(_dbOptions)) { dbContext.AddRange(GetNoticationSeed()); dbContext.Add(GetTemplateData()); dbContext.SaveChanges(); } }
public static void PopulateTestData(NotificationsDbContext dbContext) { var userGuid = Guid.Parse("b8412641-6436-49cc-816b-49b4a4f4ecd3"); dbContext.Notifications.Add(new NotificationEntity(userGuid, "title1", "text1")); dbContext.Notifications.Add(new NotificationEntity(userGuid, "title2", "text3")); dbContext.Templates.Add(new TemplateEntity { Body = "Hi {Firstname}, your appointment with {OrganisationName} at {AppointmentDateTime} has been - cancelled for the following reason: {Reason}.", Title = "Appointment Cancelled" }); dbContext.SaveChanges(); }
public OnActivityRecorded( EventManager manager, EmailTemplateRegister emailSender, CoreDbContext dbContext, IOptions <AppConfig> appConfig, NotificationsDbContext notificationsDbContext, UserManager <ApplicationUser> userManager) : base(manager) { this.emailSender = emailSender; this.dbContext = dbContext; this.appConfig = appConfig; this.notificationsDbContext = notificationsDbContext; this.userManager = userManager; }
private static void AddNotifications(NotificationsDbContext db, out Notification notification1, out Notification notification2, out Notification notification3) { notification1 = new Notification { NotificationId = 1, UserId = 1, CreatedAt = DateTime.Today - TimeSpan.FromDays(1) }.SetStringProperties(); notification2 = new Notification { NotificationId = 2, UserId = 1, CreatedAt = DateTime.Today - TimeSpan.FromDays(2) }.SetStringProperties(); notification3 = new Notification { NotificationId = 3, UserId = 1, CreatedAt = DateTime.Today - TimeSpan.FromDays(3), Subject = "Test" }; db.AddRange(notification1, notification2, notification3); db.SaveChanges(); }
public static async Task PublishForUser(this NotificationsDbContext ns, int userId, string entityType, string entityKey, string summary, string description) { var notification = new Notifications.Notification( new EntityReference(NotificationRecipientType.UserId.Value, userId.ToString()), new EntityReference(entityType, entityKey), summary, description); ns.Notifications.Add(notification); await ns.SaveChangesAsync(); }
public AddComment(ConversationsDbContext <int> context, UserContext userContext, ApplicationDbContext applicationDbContext, NotificationsDbContext notificationsDbContext, ConversationManagerCollection conversationManagerCollection, EmailTemplateRegister emailSender, IOptions <AppConfig> appConfig) { this.context = context; this.userContext = userContext; this.applicationDbContext = applicationDbContext; this.notificationsDbContext = notificationsDbContext; this.conversationManagerCollection = conversationManagerCollection; this.emailSender = emailSender; this.appConfig = appConfig; }
public async Task Get_user_Notification_Failed() { //Arrange var userId = new Guid(); //Act var catalogContext = new NotificationsDbContext(_dbOptions); var accessServ = new NotificationsAccess(catalogContext); var NotificationServ = new NotificationsService(accessServ); var testController = new NotificationsController(NotificationServ); var actionResult = await testController.GetUserCancelledAppointmentNotification(userId).ConfigureAwait(false); //Assert Assert.IsType <NotFoundObjectResult>(actionResult); var result = ((NotFoundObjectResult)actionResult).Value; Assert.Null(result); }
public static async Task PublishForUser <T>( this NotificationsDbContext ns, string description, T entity, int sendToUserId, string summary, NotificationCategory category) where T : DomainEntity { var notification = new Notification( new EntityReference(NotificationRecipientType.UserId.Value, sendToUserId.ToString()), new EntityReference(typeof(T).FullName, entity.Key.ToString()), summary, description, category.Id); ns.Notifications.Add(notification); await ns.SaveChangesAsync(); }
public async Task Get_user_Notification_success() { //Arrange var userId = testUserId; //Act var catalogContext = new NotificationsDbContext(_dbOptions); var accessServ = new NotificationsAccess(catalogContext); var NotificationServ = new NotificationsService(accessServ); var testController = new NotificationsController(NotificationServ); var actionResult = await testController.GetUserCancelledAppointmentNotification(userId).ConfigureAwait(false); //Assert Assert.IsType <OkObjectResult>(actionResult); var result = Assert.IsAssignableFrom <List <NotificationModel> >(((OkObjectResult)actionResult).Value); Assert.Equal(3, result.Count); Assert.Equal(EventType.AppointmentCancelled.ToString(), result[0].EventType); Assert.Contains("Hi Firstname, your appointment with OrganisationName at AppointmentDateTime has been cancelled for the following reason: Reason.", result[0].Message); }
public NotificationsAccess(NotificationsDbContext dbContext) { this.dbContext = dbContext; }
public NotificationsController(NotificationsDbContext db, IHubContext <NotificationsHub> hub, IUsersClient usersClient) { this.db = db; this.hub = hub; this.usersClient = usersClient; }
public NotificationsAccess(NotificationsDbContext dbContext, IMapper mapper) { this.dbContext = dbContext; this.mapper = mapper; }
public UserNotificationService(NotificationsDbContext dbContext) { _dbContext = dbContext; }
public Archive(NotificationsDbContext notificationsDbContext, UserContext userContext) { this.notificationsDbContext = notificationsDbContext; this.userContext = userContext; }
public UserRepository(NotificationsDbContext context) { _context = context; }
public NotificationsService(NotificationsDbContext dbContext) { this.dbContext = dbContext; }
public CoreMenus(NotificationsDbContext context, UserSecurityContext userSecurityContext) { this.context = context; this.userSecurityContext = userSecurityContext; }
public AccountService(NotificationsDbContext dbContext, IEncrypter encrypter) { this.dbContext = dbContext; this.encrypter = encrypter; }
public WnsTokenStorage(NotificationsDbContext dbContext) { this.dbContext = dbContext; }