Quantcast
Viewing all articles
Browse latest Browse all 764

Unable to Run Test Multiple Time With Save Method

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();

        }

 

 


Viewing all articles
Browse latest Browse all 764

Trending Articles