Exemplo n.º 1
0
        public void MiddleTier_GetFamily()
        {
            Family        result    = WebServiceTests.GetFamily();
            List <string> strErrors = new List <string>();

            if (result == null || result.ListPats == null || result.ListPats.Length < 2)
            {
                strErrors.Add("The Family" + result == null?" object is null.":result.ListPats == null?".ListPats is null.":
                              ".ListPats contains an insufficient number of patients.");
            }
            else
            {
                for (int i = 0; i < result.ListPats.Length; i++)
                {
                    Patient p = result.ListPats[i];
                    if (p.FName != (i == 0?"John":"Jennifer"))
                    {
                        strErrors.Add(string.Format("The patient.FName should be {0} but returned {1}.", i == 0?"John":"Jennifer", p.FName ?? "null"));
                    }
                    if (p.LName != null)
                    {
                        strErrors.Add("The patient.LName should be null but returned " + p.LName + ".");
                    }
                    if (i == 0 && p.AddrNote != WebServiceTests.DirtyString)
                    {
                        strErrors.Add(string.Format(@"The patient.AddrNote should be {0} but returned {1}.", WebServiceTests.DirtyString, WebServiceTests.GetObjectPat().AddrNote ?? "null"));
                    }
                    if (p.ApptModNote != WebServiceTests.NewLineString)
                    {
                        strErrors.Add(string.Format(@"The patient.ApptModNote should be {0} but returned {1}.", WebServiceTests.NewLineString, p.ApptModNote ?? "null"));
                    }
                    if (p.Email != "*****@*****.**")
                    {
                        strErrors.Add("The patient.Email should be [email protected] but returned " + (p.Email ?? "null") + ".");
                    }
                    if (p.PatStatus != PatientStatus.NonPatient)
                    {
                        strErrors.Add("The patient.PatStatus should be " + PatientStatus.NonPatient + " but returned " + p.PatStatus + ".");
                    }
                    if (p.AdmitDate == null || p.AdmitDate.Date != WebServiceTests.DateTodayTest.Date)
                    {
                        strErrors.Add(string.Format("The patient.AdmitDate should be {0} but returned {1}.", WebServiceTests.DateTodayTest.ToShortDateString(),
                                                    p.AdmitDate == null?"null":p.AdmitDate.ToShortDateString()));
                    }
                    if (p.DateTStamp != WebServiceTests.DateTEntryTest)
                    {
                        strErrors.Add(string.Format("The patient.DateTStamp should be {0} but returned {1}.", WebServiceTests.DateTEntryTest.ToString(),
                                                    p.DateTStamp == null?"null":p.DateTStamp.ToString()));
                    }
                }
            }
            Assert.IsTrue(strErrors.Count == 0);
        }