protected void btnCreate_Click(object sender, EventArgs e) { me = new MockEntity(); me.Name = "New Mock entity"; me.Save(); Session["CRUDtestME"] = me; }
protected void btnCommit_Click(object sender, EventArgs e) { me.Save(); MEInDB = me; MEInConversation = null; new BurrowFramework().CurrentConversation.FinishSpan(); lresult.Text = "Congratulations test passed!"; }
public void ManualRollbackTest() { MockEntity me = new MockEntity(); me.Save(); Assert.IsNotNull(new MockEntityDAO().Get(me.Id)); new BurrowFramework().CurrentConversation.GiveUp(); new BurrowFramework().CloseWorkSpace(); new BurrowFramework().InitWorkSpace(); Assert.IsNull(new MockEntityDAO().Get(me.Id)); }
public void RollBackShouldCloseWorkSpaceTest() { ITransactionManager tm = bf.CurrentConversation.TransactionManager; tm.Begin(); MockEntity mo3 = new MockEntity(); mo3.Save(); tm.Rollback(); Assert.IsNull(bf.CurrentConversation); bf.InitWorkSpace(); Assert.IsNull(MockEntityDAO.Instance.Get(mo3.Id), "Rolled back transaction did get commit"); }
public void Crud() { MockEntity2 m2 = new MockEntity2(); m2.Save(); RestartBF(); MockEntity m = new MockEntity(); m.Save(); RestartBF(); Assert.IsNotNull(MockEntity2DAO.Instance.Get(m2.Id)); Assert.IsNotNull(MockEntityDAO.Instance.Get(m.Id)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MockEntity m = new MockEntity(); m.Save(); m.StringList.Add("testString"); m.StringList.Add("testString2"); bf.GetSession().Clear(); me = MockEntityDAO.Instance.Get(m.Id); //me is now holding an uninitilized mockEntity bf.CurrentConversation.SpanWithPostBacks(); } }
protected void btnStart_Click(object sender, EventArgs e) { if (currentStepDone) { if (currentStepProgress < 4) { lStatus.Text = "Step " + currentStep + " is not done by other pages yet, finish them first"; return; } else { currentStep++; currentStepDone = false; } } if (currentStep == 0) { bf.CurrentConversation.SpanWithPostBacks(); me = new MockEntity(); Checker.CheckSpanningConversations(currentStepProgress + 1); } if (currentStep < 3) { Checker.AssertEqual(me.Number, currentStep); me.Number++; lStatus.Text = "Step " + currentStep + " is done for this page"; } else { me.Save(); me = null; bf.CurrentConversation.FinishSpan(); lStatus.Text = "This page is finished! "; btnStart.Visible = false; } currentStepDone = true; currentStepProgress++; btnStart.Text = "Go Step " + (currentStep + 1); }
public void MultipleTransactionTest() { ITransactionManager tm = bf.CurrentConversation.TransactionManager; tm.Begin(); MockEntity mo1 = new MockEntity(); mo1.Save(); tm.Commit(); tm.Begin(); MockEntity mo2 = new MockEntity(); mo2.Save(); tm.Commit(); tm.Begin(); Assert.IsNotNull(MockEntityDAO.Instance.Get(mo1.Id)); Assert.IsNotNull(MockEntityDAO.Instance.Get(mo2.Id)); tm.Commit(); TearDown(); }