Esempio n. 1
0
        public void SingleVarNameVarLabel()
        {
            SurveyReport SR = new SurveyReport();

            ReportSurvey   s = new ReportSurvey("TT1");
            SurveyQuestion q = new SurveyQuestion("AA000", "001");

            s.AddQuestion(q);
            s.VarLabelCol = true;
            SR.AddSurvey(s);

            SR.GenerateReport();

            DataTable dt = SR.ReportTable;

            bool hasQnumCol     = dt.Columns[0].ColumnName.Equals("Qnum");
            bool hasVarNameCol  = dt.Columns[1].ColumnName.Equals("VarName");
            bool hasQuestionCol = dt.Columns[2].ColumnName.Equals(s.SurveyCode);
            bool hasVarLabelCol = dt.Columns[3].ColumnName.Equals(s.SurveyCode + " VarLabel");
            bool hasRows        = dt.Rows.Count == s.Questions.Count;

            bool hasAllColumns = hasQnumCol && hasVarNameCol && hasQuestionCol && hasVarLabelCol;

            Assert.IsTrue(hasAllColumns && hasRows);
        }
Esempio n. 2
0
        public void SingleVarNameSingleTranslation()
        {
            SurveyReport SR = new SurveyReport();

            ReportSurvey   s = new ReportSurvey("TT1");
            SurveyQuestion q = new SurveyQuestion("AA000", "001");

            q.Translations.Add(new Translation()
            {
                Language        = "TestLang",
                TranslationText = "Translation Text"
            });
            s.AddQuestion(q);
            s.TransFields.Add("TestLang");
            SR.AddSurvey(s);

            SR.GenerateReport();

            DataTable dt = SR.ReportTable;

            bool hasQnumCol        = dt.Columns[0].ColumnName.Equals("Qnum");
            bool hasVarNameCol     = dt.Columns[1].ColumnName.Equals("VarName");
            bool hasQuestionCol    = dt.Columns[2].ColumnName.Equals(s.SurveyCode);
            bool hasTranslationCol = dt.Columns[3].ColumnName.Equals(s.SurveyCode + " " + s.TransFields[0]);
            bool hasRows           = dt.Rows.Count == s.Questions.Count;

            bool hasAllColumns = hasQnumCol && hasVarNameCol && hasQuestionCol && hasTranslationCol;

            Assert.IsTrue(hasAllColumns && hasRows);
        }
Esempio n. 3
0
        public void SingleSurveyMultiQuestionReportTable()
        {
            SurveyReport SR = new SurveyReport();
            ReportSurvey s  = new ReportSurvey("Test");

            SR.AddSurvey(s);

            for (int i = 0; i < 10; i++)
            {
                SurveyQuestion sq = new SurveyQuestion();
                sq.VarName.FullVarName = "AA" + i.ToString("000");
                sq.Qnum = i.ToString("000");
                sq.PreP = "Test PreP" + i;
                sq.LitQ = "Test LitQ" + i;
                for (int j = 1; j <= i; j++)
                {
                    sq.RespOptions += j + "   Response Option " + j;
                }

                s.AddQuestion(sq);
            }

            int result = SR.GenerateReport();

            Assert.IsTrue(result == 0);

            Assert.IsTrue(SR.ReportTable.Rows.Count == 10);
        }
Esempio n. 4
0
        public ComparisonTests()
        {
            primary = new ReportSurvey("TT1");

            SurveyQuestion sq1 = new SurveyQuestion("BI100", "001");
            SurveyQuestion sq2 = new SurveyQuestion("BI101", "002");

            primary.AddQuestion(sq1);
            primary.AddQuestion(sq2);

            other = new ReportSurvey("TT2");

            other.AddQuestion(sq1);
            other.AddQuestion(sq2);

            comparer = new Comparison(primary, other);
        }
Esempio n. 5
0
        public void Compare_ReInsert_ExtraOtherQuestion_OtherQnum()
        {
            // default comparison settings: show and reinsert deletions
            // other survey has an extra question
            // other survey is Qnum survey

            other.Qnum = true;

            SurveyQuestion extra = new SurveyQuestion("EX100", "003");

            other.AddQuestion(extra);

            comparer.CompareByVarName();

            Assert.IsTrue(extra.VarName.FullVarName.StartsWith("[yellow]"));
        }
Esempio n. 6
0
        public void Compare_ReInsert_ExtraPrimaryQuestion_OtherQnum()
        {
            // default comparison settings: show and reinsert deletions
            // primary survey has an extra question
            // extra question should be added to other survey and original question unchanged

            other.Qnum = true;

            SurveyQuestion extra = new SurveyQuestion("EX100", "003");

            primary.AddQuestion(extra);

            comparer.CompareByVarName();

            SurveyQuestion extra1 = other.Questions[other.Questions.Count - 1];

            Assert.IsFalse(extra.VarName.FullVarName.StartsWith("[s][t]"));
            Assert.IsTrue(extra1.VarName.FullVarName.StartsWith("[s][t]"));
        }
Esempio n. 7
0
        public void SingleSurveySingleQuestionReportTable()
        {
            SurveyReport SR = new SurveyReport();
            ReportSurvey s  = new ReportSurvey("Test");

            SR.AddSurvey(s);

            SurveyQuestion sq = new SurveyQuestion();

            sq.VarName.FullVarName = "AA000";
            sq.Qnum        = "000";
            sq.PreP        = "Test PreP";
            sq.LitQ        = "Test LitQ";
            sq.RespOptions = "1   Yes";

            s.AddQuestion(sq);

            int result = SR.GenerateReport();

            Assert.IsTrue(result == 0);

            Assert.IsTrue(SR.ReportTable.Rows.Count == 1);
        }
        public void RemoveRepeats_ID2_PrePCleared()
        {
            // Arrange
            survey.AddQuestion(
                new SurveyQuestion("AA000", "000a")
            {
                ID   = 1,
                PreP = wording
            }
                );

            survey.AddQuestion(new SurveyQuestion("AA001", "000b")
            {
                ID = 2, PreP = wording
            });

            // Act
            survey.RemoveRepeats();

            // Assert
            Assert.IsTrue(survey.QuestionByID(2).PreP == "");
        }