public void NewInMemoryObjctUpdateTest() { var x = Pdf1099K.GetByTaxYearAndID(2012, "113019324").FirstOrDefault(); var newObj = new Pdf1099K { TaxYear = x.TaxYear, FileName = x.FileName, TaxID = x.TaxID, AccountNum = x.AccountNum, FederalID = x.FederalID, FileLocation = x.FileLocation, PDFContent = x.PDFContent }; newObj.Save(); Assert.AreEqual(x.ID, newObj.ID); Assert.IsTrue(DateTime.Now.Subtract(newObj.UpdateAt.Value) < TimeSpan.FromSeconds(3)); }
public void SaveMutipleTime() { using (var ctx = new Extract1099KEntities()) { var testfile = Pdf1099K.GetByTaxYearAndID(2012, "113019324").FirstOrDefault(); var federalID = testfile.FederalID; testfile.FederalID = "xxxxxxx"; testfile.Save(ctx); ctx.SaveChanges(); var savedFile = Pdf1099K.GetByTaxYearAndID(2012, "113019324").FirstOrDefault(); Assert.AreEqual("xxxxxxx", testfile.FederalID); testfile.FederalID = federalID; testfile.Save(ctx); ctx.SaveChanges(); savedFile = Pdf1099K.GetByTaxYearAndID(2012, "113019324").FirstOrDefault(); Assert.AreEqual(federalID, testfile.FederalID); } }