Csla 4.3.13 / Visual Studio 2010
I am unable to run test scripts multiple time which contains a call to the save method without rebuilding the solution. If the po.save is commented out in the code below can be run an infinite number of time. If the save is included I receive 'DataPortal.Fetch failed (Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.)' upon the call to GetVendor. The PO.Insert is run inside using statements
[TestMethod()]
public void _MultiRunDiagnostics()
{
PO po = PO.NewPO(); po.Vendor = ror.Vendor.GetVendor(1); po.Number = DateTime.Now.Ticks.ToString().Substring(0, 12); po.Date = DateTime.Now; Assert.IsTrue(po.IsSelfValid); Assert.IsFalse(po.IsSavable); Assert.IsTrue(po.IsStatus(PO.eStatus.New)); Assert.AreEqual<string>(DateTime.Today.ToShortDateString(), po.StatusDate.ToShortDateString()); PODetailListItem detail = po.DetailLines.AddNew(); detail.ItemID = 4; detail.Quantity = 1; Assert.AreEqual<Decimal>(1.01m, detail.Cost); Assert.IsTrue(detail.IsSavable); Assert.IsTrue(po.IsSavable); // test can be run repeatedly if save is excluded po = po.Save(); }
Then you must resolve the issues in the GetVendor or the Save method.
Obviously something is not either inserted into a database (and create duplicates) or there is something wrong with the SQL in Vendor.DataPortal_Fetch.
Copyright (c) Marimer LLC