public IList <IObligation> GetObligationsForVisitor(IVisitor visitor)
        {
            var obligationIds = _rulesetLoader.GetRulesets()
                                .Where(r => r.IsMatch(visitor))
                                .Select(r => r.ObligationId)
                                .Distinct();

            return(_obligationLoader.GetObligations().Where(o => obligationIds.Contains(o.Id)).ToList());
        }
Ejemplo n.º 2
0
        public void LoadObligations()
        {
            // Act
            var obligations = _loader.GetObligations();

            // Assert
            Assert.IsNotNull(obligations);
            Assert.AreEqual(3, obligations.Count);
        }
Ejemplo n.º 3
0
        public void LoadsFromCache()
        {
            // Arrange
            _loader = new FileObligationLoader(_fakeCacheManger.Object, _fakeFilePathResolver.Object, DirectoryName, CacheName);
            _fakeCacheManger.Setup(x => x.Contains(CacheName)).Returns(true);

            // Act
            _loader.GetObligations();

            //Assert
            _fakeCacheManger.Verify(x => x.Get(CacheName), Times.Once);
            _fakeCacheManger.Verify(x => x.Add(CacheName, It.IsAny <List <IObligation> >()), Times.Never);
        }
Ejemplo n.º 4
0
 public void Content_JsonFilesHaveValidJsonSyntax()
 {
     // Arrange
     // Act
     try
     {
         _questionLoader.GetQuestions();
         _obligationLoader.GetObligations();
         _rulesetLoader.GetRulesets();
         _personaLoader.GetPersonas();
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }