public void MiddleTier_GetProcCodeWithDirtyProperty() { Def d; if (Defs.GetDefsForCategory(DefCat.ProcCodeCats, true).Count == 0) { d = new Def() { Category = DefCat.ProcCodeCats, ItemName = WebServiceTests.DirtyString }; d.DefNum = Defs.Insert(d); } else { d = Defs.GetFirstForCategory(DefCat.ProcCodeCats, true); d.ItemName = WebServiceTests.DirtyString; Defs.Update(d); } Defs.RefreshCache(); d = Defs.GetDef(DefCat.ProcCodeCats, d.DefNum); ProcedureCode pc = new ProcedureCode { IsNew = true, ProcCat = d.DefNum }; ProcedureCode pc2 = new ProcedureCode { IsNew = true }; List <ProcedureCode> listPcs = new List <ProcedureCode>(); List <string> strErrors = new List <string>(); try { listPcs = WebServiceTests.GetProcCodeWithDirtyProperty(pc, pc2); } catch (Exception ex) { strErrors.Add("Cannot serialize a property with a getter that does not retrieve the same value the setter is manipulating."); strErrors.Add(ex.Message); strErrors.Add(ex.StackTrace); } if (listPcs.Count > 0 && (listPcs[0].IsNew || listPcs[1].IsNew)) { strErrors.Add(string.Format("One or more of the returned ProcedureCode objects IsNew flag should be {0} but returned {1}.", "false", "true")); } if (listPcs.Count > 0 && (listPcs[0].ProcCat != d.DefNum || listPcs[1].ProcCat != d.DefNum)) { strErrors.Add("One or more of the ProcedureCode objects returned did not have the correct ProcCat."); } if (listPcs.Count > 0 && (listPcs[0].ProcCatDescript != d.ItemName || listPcs[1].ProcCatDescript != d.ItemName)) { strErrors.Add("One or more of the ProcedureCode objects returned did not have the correct dirty string."); } Assert.IsTrue(strErrors.Count == 0); }