Exemple #1
0
        private void SetUpTestingContext(TestingContext testingContext)
        {
            testingContext.AddPrincipalMock();
            testingContext.AddBinaryServiceMock();
            testingContext.AddLogServiceMock();
            testingContext.AddCranAppSettings();
            testingContext.AddInfoTextServiceMock();
            testingContext.AddInMemoryDb();
            testingContext.AddUserService();

            Mock <IWebPushClient> webPushClientMock = new Mock <IWebPushClient>(MockBehavior.Loose);

            webPushClientMock.Setup(x => x.SendNotificationAsync(It.IsAny <PushSubscription>(),
                                                                 It.IsAny <string>(), It.IsAny <VapidDetails>()))
            .Returns(Task.CompletedTask);

            testingContext.DependencyMap[typeof(IWebPushClient)] = webPushClientMock.Object;
        }
Exemple #2
0
        private void SetUpTestingContext(TestingContext testingContext)
        {
            testingContext.AddPrincipalMock();
            testingContext.AddInMemoryDb();
            testingContext.AddUserService();
            testingContext.AddBusinessSecurityService();
            testingContext.AddLogServiceMock();
            testingContext.AddGermanCultureServiceMock();
            testingContext.AddBinaryServiceMock();
            testingContext.AddInfoTextServiceMock();
            testingContext.AddCacheService();
            testingContext.DependencyMap[typeof(ICommentsService)] = testingContext.GetService <CommentsService>();
            testingContext.DependencyMap[typeof(ITagService)]      = testingContext.GetService <TagService>();



            Mock <INotificationService> notificationMock = new Mock <INotificationService>(MockBehavior.Loose);

            notificationMock.Setup(x => x.SendNotificationAboutQuestionAsync(It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(Task.CompletedTask);

            testingContext.DependencyMap[typeof(INotificationService)] = notificationMock.Object;
        }