public void Test_searchCriteriaQuerySeverity()
        {
            SearchManagementController searchCon = new SearchManagementController();

            SearchCriteria s = new SearchCriteria

            {
                anyKeywordString = null,
                allKeywordString = null,
                noneKeywordString = null,
                patientFirstName = null,
                patientLastName = null,
                questionType = null,
                requestorFirstName = null,
                requestorLastName = "100",
                requestStatus = null,
                tumorGroup = null,
                severity = "Moderate",
                consequence = null,
            };
            List<Request> results = searchCon.searchCriteriaQuery(s);
            //  Assert.AreEqual(results.Count, 1);
            Assert.AreEqual(results[0].PatientFName, "TSMC Test2");
            Assert.AreEqual(results[0].RequestorFName, "20");
            Assert.AreEqual(results[0].RequestorLName, "100");
            Assert.AreEqual(results[0].QuestionResponses[0].Severity, 1);
        }
 public void Test_typeIDStringToList()
 {
     SearchManagementController searchCon = new SearchManagementController();
     List<int> intIDs = searchCon.typeIdStringtoList("1,2,3,40,1000000", ",");
     Assert.AreEqual(intIDs[0], 1);
     Assert.AreEqual(intIDs[1], 2);
     Assert.AreEqual(intIDs[2], 3);
     Assert.AreEqual(intIDs[3], 40);
     Assert.AreEqual(intIDs[4], 1000000);
 }
 public void Test_keywordsToList()
 {
     SearchManagementController searchCon = new SearchManagementController();
     String searchString = "Chemotherapy, pain, advil, drug dose";
     List<string> searchList = searchCon.keywordsToList(searchString, ",");
     Assert.IsNotNull(searchList);
     Assert.AreEqual(searchList.Count, 4);
     Assert.IsTrue(String.Equals(searchList[0], "Chemotherapy"));
     Assert.IsTrue(String.Equals(searchList[1], "pain"));
     Assert.IsTrue(String.Equals(searchList[2], "advil"));
     Assert.IsTrue(String.Equals(searchList[3], "drug dose"));
 }
        public void Test_searchCriteriaQueryCombineKeywords()
        {
            SearchManagementController searchCon = new SearchManagementController();

            SearchCriteria s = new SearchCriteria

            {
                anyKeywordString = null,
                allKeywordString = _randomKeyword.KeywordValue + "," + _randomKeyword2.KeywordValue,
                noneKeywordString = _randomKeyword4.KeywordValue,
                patientFirstName = null,
                patientLastName = null,
                questionType = null,
                requestorFirstName = null,
                requestorLastName = null,
                requestStatus = null,
                tumorGroup = null,
                severity = null,
                consequence = null,
            };
            List<Request> results = searchCon.searchCriteriaQuery(s);
            Assert.AreEqual(results.Count, 1);
            Assert.AreEqual(results[0].PatientFName, "TSMC Test");
            Assert.AreEqual(results[0].RequestorFName, "10");
            Assert.AreEqual(results[0].RequestorLName, "100");
        }
        public void Test_getKeywords()
        {
            SearchManagementController searchCon = new SearchManagementController();

            List<int> kwIDs = searchCon.getKeywords(_randomKeyword.KeywordValue + "," + _randomKeyword2.KeywordValue + ", 57309457");
            Assert.AreEqual(kwIDs[0],  (from k in _dc.Keywords
                                           where k.KeywordValue == _randomKeyword.KeywordValue
                                           select k.KeywordID).First());
            Assert.AreEqual(kwIDs[1], (from k in _dc.Keywords
                                           where k.KeywordValue == _randomKeyword2.KeywordValue
                                           select k.KeywordID).First());
            Assert.AreEqual(kwIDs.Count, 2);
        }
        public void Test_isEmptySearchCriteriaNotEmpty()
        {
            SearchManagementController searchCon = new SearchManagementController();

            SearchCriteria s = new SearchCriteria
            {
                anyKeywordString = "Chemotherapy",
                allKeywordString = null,
                noneKeywordString = null,
                patientFirstName = null,
                patientLastName = null,
                questionType = null,
                requestorFirstName = null,
                requestorLastName = null,
                requestStatus = null,
                tumorGroup = null,
                severity = null,
                consequence = null,
            };

            bool criteriaEmpty = searchCon.isEmptySearchCriteria(s);
            Assert.IsFalse(criteriaEmpty);
        }
        public void Test_enumToIDs()
        {
            SearchManagementController searchCon = new SearchManagementController();

            List<int> severityIDs = searchCon.enumToIDs("Major, Minor, Moderate",
                                                    typeof(Constants.Severity));
            Assert.AreEqual(severityIDs[0], 0);
            Assert.AreEqual(severityIDs[1], 2);
            Assert.AreEqual(severityIDs[2], 1);

            List<int> consequenceIDs =
                searchCon.enumToIDs("Probable, Unlikely, Certain, Possible", typeof(Constants.Consequence));

            Assert.AreEqual(consequenceIDs[0], 1);
            Assert.AreEqual(consequenceIDs[1], 3);
            Assert.AreEqual(consequenceIDs[2], 0);
            Assert.AreEqual(consequenceIDs[3], 2);
        }
        public void Test_emptyButValidKeywordWithOneValid()
        {
            SearchManagementController searchCon = new SearchManagementController();
            SearchCriteria oneKeyInvalid = new SearchCriteria
            {
                anyKeywordString = _randomKeyword.KeywordValue,
                allKeywordString = "3-09258340598!@#$",
                noneKeywordString = null,
                patientFirstName = null,
                patientLastName = null,
                questionType = null,
                requestorFirstName = null,
                requestorLastName = null,
                requestStatus = null,
                tumorGroup = null,
                severity = null,
                consequence = null,
            };

            bool oneKeywordInvalid =
                searchCon.emptyButValidKeywords(oneKeyInvalid);
            Assert.IsFalse(oneKeywordInvalid);
        }
        public void Test_emptyButValidKeywordsValidKw()
        {
            SearchManagementController searchCon = new SearchManagementController();

            SearchCriteria validKey = new SearchCriteria
            {
                anyKeywordString = _randomKeyword.KeywordValue,
                allKeywordString = null,
                noneKeywordString = null,
                patientFirstName = null,
                patientLastName = null,
                questionType = null,
                requestorFirstName = null,
                requestorLastName = null,
                requestStatus = null,
                tumorGroup = null,
                severity = null,
                consequence = null,
            };

            bool keywordValid = searchCon.emptyButValidKeywords(validKey);
            Assert.IsFalse(keywordValid);
        }
        public void Test_emptyButValidKeywordsInvalidKw()
        {
            SearchManagementController searchCon = new SearchManagementController();
            SearchCriteria invalidKey = new SearchCriteria
            {
                anyKeywordString = null,
                allKeywordString = "239048230-948!@#",
                noneKeywordString = null,
                patientFirstName = null,
                patientLastName = null,
                questionType = null,
                requestorFirstName = null,
                requestorLastName = null,
                requestStatus = null,
                tumorGroup = null,
                severity = null,
                consequence = null,
            };

            bool keywordInvalid = searchCon.emptyButValidKeywords(invalidKey);
            Assert.IsTrue(keywordInvalid);
        }
        public void Test_constructCriteriaString()
        {
            SearchManagementController searchCon = new SearchManagementController();
            SearchCriteria sc = new SearchCriteria
            {
                anyKeywordString = "Chemotherapy, Drug Interaction",
                allKeywordString = "Advil",
                noneKeywordString = "Pain",
                patientFirstName = "Kurt",
                patientLastName = "Eiselt",
                startTime = new DateTime(2013, 2, 1),
                completionTime = new DateTime(2013, 4, 1),
                requestorFirstName = "Jing",
                requestorLastName = "Zhu",
                requestStatus = "Open",
                severity = "Major",
                consequence = "Possible",
            };
            List<string> cs = searchCon.constructCriteriaString(sc);
            Assert.IsNotNull(cs);
            Assert.AreEqual(cs.Count, 12);
            List<string> temp = new List<string>();
            temp.Add("Any of These Keywords: Chemotherapy, Drug Interaction");
            temp.Add("All of These Keywords: Advil");
            temp.Add("None of These Keywords: Pain");
            temp.Add("Start Time: 2/1/2013");
            temp.Add("Completed Time: 4/1/2013");
            temp.Add("Status: Open");
            temp.Add("First Name: Jing");
            temp.Add("Last Name: Zhu");
            temp.Add("First Name: Kurt");
            temp.Add("Last Name: Eiselt");
            temp.Add("Severity: Major");
            temp.Add("Probability of Consequence: Possible");

            Assert.AreEqual(cs.Count, temp.Count);
            for (int i = 0; i < temp.Count; i++)
            {
                Assert.AreEqual(cs[i], temp[i]);
            }
        }