Ejemplo n.º 1
0
        public async void ListDefinedTerms_Returns_Terms_Test()
        {
            var termsService = new TermsService(_definitionRepositorymock.Object);
            var definitions  = await termsService.ListDefinedTerms();

            Assert.IsNotNull(definitions);
            Assert.IsTrue(definitions.Any());
        }
Ejemplo n.º 2
0
    protected async Task <TermsWithContent> GetNewestTerms(Guid userId, string language)
    {
        return((await Cache.GetOrCreateAsync($"terms-{language}-{userId}", async e => {
            e.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(60);

            return await TermsService.GetNewestTermsAsync("terms", userId.ToString(), language);
        })).Data);
    }
Ejemplo n.º 3
0
        public async void ListDefinedTerms_Returns_Terms_Returns_Synonyms()
        {
            var termsService = new TermsService(_definitionRepositorymock.Object);
            var definitions  = await termsService.ListDefinedTerms();

            Assert.IsNotNull(definitions);
            Assert.AreEqual(4, definitions.Count());
            Assert.AreEqual(TEST_SYNONYM, definitions.Last().Term);
        }
Ejemplo n.º 4
0
    public async Task <IActionResult> AcceptTerms()
    {
        Guid   userId   = GetUserId();
        string language = Request.GetCurrentLanguage();

        TermsWithContent newestTerms = await GetNewestTerms(userId, language);

        await TermsService.MarkReadAsync(newestTerms.Id, userId.ToString(), language);

        //Clear cache so we get the updated boolean that the user has read the terms
        Cache.Remove($"terms-{language}-{userId}");

        return(RedirectToAction("index", new { lang = language }));
    }
Ejemplo n.º 5
0
 public RequireAcceptedTerms()
 {
     AllowedRoutes = new List <RouteDescriptor>();
     AllowedRoutes.Add(new RouteDescriptor {
         Controller = "Terms", Action = "Index"
     });
     AllowedRoutes.Add(new RouteDescriptor {
         Controller = "Terms", Action = "Accept"
     });
     AllowedRoutes.Add(new RouteDescriptor {
         Controller = "Account", Action = "Logout"
     });
     AllowedRoutes.Add(new RouteDescriptor {
         Controller = "Payments", Action = "PaySchedules "
     });
     TermsService = new TermsService();
 }
Ejemplo n.º 6
0
        private async Task <IEnumerable <NHS111.Models.Models.Domain.DefinedTerm> > SetupAndRunFindContainedTerms(string inputString)
        {
            var termsService = new TermsService(_definitionRepositorymock.Object);

            return(await termsService.FindContainedTerms(inputString));
        }