protected void btnCreate_Click(object sender, EventArgs e) { me = new MockEntity(); me.Name = "New Mock entity"; me.Save(); Session["CRUDtestME"] = me; }
protected void btnRedirect_Click(object sender, EventArgs e) { MockEntity mo = new MockEntity(); new MockEntityDAO().Save(mo); Session["mo"] = mo; Response.Redirect("result.aspx"); }
protected void btnDelete_Click(object sender, EventArgs e) { if (me != null) { me.Delete(); } Session["CRUDtestME"] = null; me = new MockEntityDAO().Get(me.Id); }
private string GetNumber(MockEntity m) { if (m != null) { return m.Number.ToString(); } else { return "NULL"; } }
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 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)); }
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"); }
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(); } }
public override bool Equals(object obj) { if (Id == 0) { return(Equals(this, obj)); } else { MockEntity that = obj as MockEntity; if (that == null) { return(false); } return(Id.Equals(that.Id)); } }
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(); }
public void Save(MockEntity me) { Sess.Save(me); }
protected void btnCommit_Click(object sender, EventArgs e) { me.Save(); MEInDB = me; MEInConversation = null; new BurrowFramework().CurrentConversation.FinishSpan(); lresult.Text = "Congratulations test passed!"; }
protected void btnStart_Click(object sender, EventArgs e) { MEInConversation = new MockEntity(); BurrowFramework f = new BurrowFramework(); f.CurrentConversation.SpanWithPostBacks(GetStrategy()); }
protected void btnError_Click(object sender, EventArgs e) { MockEntity mo = new MockEntity(); new MockEntityDAO().Save(mo); //added here to test if transaction got committed or locked after exception throw new CustomException(); }
public void Delete(MockEntity me) { Sess.Delete(me); }