예제 #1
0
        public void MiddleTier_GetListMedLabsSpecialChars()
        {
            List <MedLab> listMLabs = WebServiceTests.GetListMedLabsSpecialChars();
            List <string> strErrors = new List <string>();

            if (listMLabs == null || listMLabs.Count < 1)
            {
                strErrors.Add("The list of MedLabs is " + listMLabs == null?"null.":"empty.");
            }
            else
            {
                MedLab mlab = listMLabs[0];
                if (mlab.MedLabNum != 1)
                {
                    strErrors.Add("The MedLabNum should be 1 but returned " + mlab.MedLabNum + ".");
                }
                if (mlab.NoteLab != WebServiceTests.DirtyString)
                {
                    strErrors.Add(string.Format(@"The MedLab.NoteLab should be {0} but returned {1}.", WebServiceTests.DirtyString, mlab.NoteLab ?? "null"));
                }
                if (mlab.NotePat != WebServiceTests.NewLineString)
                {
                    strErrors.Add(string.Format(@"The MedLab.NotePat should be {0} but returned {1}.", WebServiceTests.NewLineString, mlab.NotePat ?? "null"));
                }
                if (mlab.ResultStatus != ResultStatus.P)
                {
                    strErrors.Add("The MedLab.ResultStatus should be " + ResultStatus.P + " but returned " + mlab.ResultStatus + ".");
                }
                if (mlab.DateTimeEntered == null || mlab.DateTimeEntered.Date != WebServiceTests.DateTodayTest.Date)
                {
                    strErrors.Add(string.Format("The MedLab.DateTimeEntered should be {0} but returned {1}.", WebServiceTests.DateTodayTest.ToShortDateString(),
                                                mlab.DateTimeEntered == null?"null":mlab.DateTimeEntered.ToShortDateString()));
                }
                if (mlab.DateTimeReported != WebServiceTests.DateTEntryTest)
                {
                    strErrors.Add(string.Format("The MedLab.DateTimeReported should be {0} but returned {1}.", WebServiceTests.DateTEntryTest.ToString(),
                                                mlab.DateTimeReported == null?"null":mlab.DateTimeReported.ToString()));
                }
                if (mlab.ListMedLabResults == null || mlab.ListMedLabResults.Count < 1)
                {
                    strErrors.Add("The list of MedLabResults for the MedLab is " + mlab.ListMedLabResults == null?"null.":"empty.");
                }
                else
                {
                    MedLabResult mlr = mlab.ListMedLabResults[0];
                    if (mlr.MedLabResultNum != 2)
                    {
                        strErrors.Add("The MedLabResultNum should be 2 but returned " + mlr.MedLabResultNum + ".");
                    }
                    if (mlr.MedLabNum != 1)
                    {
                        strErrors.Add("The MedLabResult.MedLabNum should be 1 but returned " + mlr.MedLabNum + ".");
                    }
                    if (mlr.Note != WebServiceTests.DirtyString)
                    {
                        strErrors.Add(string.Format(@"The MedLabResult.Note should be {0} but returned {1}.", WebServiceTests.DirtyString, mlr.Note ?? "null"));
                    }
                    if (mlr.ObsText != WebServiceTests.NewLineString)
                    {
                        strErrors.Add(string.Format(@"The MedLabResult.ObsText should be {0} but returned {1}.", WebServiceTests.NewLineString, mlr.ObsText ?? "null"));
                    }
                    if (mlr.ObsSubType != DataSubtype.PDF)
                    {
                        strErrors.Add("The MedLabResult.ObsSubType should be " + DataSubtype.PDF + " but returned " + mlr.ObsSubType + ".");
                    }
                    if (mlr.DateTimeObs != WebServiceTests.DateTEntryTest)
                    {
                        strErrors.Add(string.Format("The MedLabResult.DateTimeObs should be {0} but returned {1}.", WebServiceTests.DateTEntryTest.ToString(),
                                                    mlr.DateTimeObs == null?"null":mlr.DateTimeObs.ToString()));
                    }
                }
            }
            Assert.IsTrue(strErrors.Count == 0);
        }