コード例 #1
0
 public void Content_JsonFilesHaveValidJsonSyntax()
 {
     // Arrange
     // Act
     try
     {
         _questionLoader.GetQuestions();
         _obligationLoader.GetObligations();
         _rulesetLoader.GetRulesets();
         _personaLoader.GetPersonas();
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
コード例 #2
0
        public void LoadPersonas()
        {
            // Act
            var questions = _loader.GetPersonas();

            // Assert
            Assert.IsNotNull(questions);
            Assert.AreEqual(1, questions.Count);
            Assert.IsNotNull(questions.First().IncludedAnswerList);
            Assert.AreEqual(2, questions.First().IncludedAnswerList.Length);
        }
コード例 #3
0
        public void AddsToCache()
        {
            // Arrange
            _loader = new FilePersonaLoader(_fakeCacheManger.Object, _fakeFilePathResolver.Object, DirectoryName, CacheName);
            _fakeCacheManger.Setup(x => x.Contains(CacheName)).Returns(false);

            // Act
            _loader.GetPersonas();

            //Assert
            _fakeCacheManger.Verify(x => x.Get(CacheName), Times.Once);
            _fakeCacheManger.Verify(x => x.Add(CacheName, It.IsAny <List <IPersona> >()), Times.Once);
        }
コード例 #4
0
 public IPersona GetPersona(IDictionary <string, IAnswer[]> visitorAnswers)
 {
     return(_personaLoader.GetPersonas().FirstOrDefault(persona => DoesPersonaMatch(persona, visitorAnswers)));
 }