Exemplo n.º 1
0
        public async void GetCareAdvice_WithArgs_Builds_GenderAndAge_Where_Statement()
        {
            SetupMockImplimentations();
            var expectedAndWhereClause = "i.id =~ \".*-" + _ageCategory.Value + "-" + _gender.Value + "\"";
            var sut = new CareAdviceRepository(_mockGraph.Object);
            await sut.GetCareAdvice(_ageCategory, _gender, _keywords, _dxCode);

            _mockQuery.Verify(q => q.AndWhere(It.Is <string>(s => s == expectedAndWhereClause)), Times.Once);
        }
Exemplo n.º 2
0
        public async void GetCareAdvice_WithArgs_Builds_ExcludesKeywords_Where_Statement()
        {
            SetupMockImplimentations();
            var expectedAndWhereClause = "(i.excludeKeywords IS null OR NOT (ANY(ex in i.excludeKeywords WHERE ex = \"Keyword1\") OR ANY(ex in i.excludeKeywords WHERE ex = \"Keyword2\")))";
            var sut = new CareAdviceRepository(_mockGraph.Object);
            await sut.GetCareAdvice(_ageCategory, _gender, _keywords, _dxCode);

            _mockQuery.Verify(q => q.AndWhere(It.Is <string>(s => s == expectedAndWhereClause)), Times.Once);
        }
Exemplo n.º 3
0
        public async void GetCareAdvice_WithArgs_Builds_Match_Statement()
        {
            SetupMockImplimentations();

            var expectedMatchClause = "(t:CareAdviceText)-[:hasText*]-(i:InterimCareAdvice)-[:presentsFor]->(o:Outcome)";
            var sut = new CareAdviceRepository(_mockGraph.Object);
            await sut.GetCareAdvice(_ageCategory, _gender, _keywords, _dxCode);

            _mockQuery.Verify(q => q.Match(It.Is <string>(s => s == expectedMatchClause)), Times.Once);
        }
Exemplo n.º 4
0
        public async void GetCareAdvice_WithArgs_Builds_Keywords_Where_Statement()
        {
            SetupMockImplimentations();

            var expectedKeywordsWhereClause = "i.keyword in [\"Keyword1\",\"Keyword2\"]";
            var sut = new CareAdviceRepository(_mockGraph.Object);
            await sut.GetCareAdvice(_ageCategory, _gender, _keywords, _dxCode);

            _mockQuery.Verify(q => q.Where(It.Is <string>(s => s == expectedKeywordsWhereClause)), Times.Once);
        }
Exemplo n.º 5
0
        public async void GetCareAdvice_WithArgs_BuildsCorrectQuery()
        {
            SetupMockImplimentations();

            var sut = new CareAdviceRepository(_mockGraph.Object);
            await sut.GetCareAdvice(_ageCategory, _gender, _keywords, _dxCode);

            _mockQuery.Verify(q => q.Where(It.Is <string>(s => s.Contains(_keywords[0]) && s.Contains(_keywords[1]))), Times.Once);
            _mockQuery.Verify(q => q.AndWhere(It.Is <string>(s => s.Contains(_dxCode.Value))), Times.Once);
            _mockQuery.Verify(q => q.AndWhere(It.Is <string>(s => s.Contains(_ageCategory.Value) && s.Contains(_gender.Value))), Times.Once);
        }