public void SetResultSelectsCorrectResult() { TestUserControl uc = new TestUserControl(); Result theResult = A.Fake <Result>(); uc.Results.Add("theResult", theResult); uc.SetResult("theResult"); }
public void SetResultBubblesUpHierarchyUntilFirstMatch() { TestUserControl c1 = new TestUserControl(); Control c11 = new Control(); c1.Controls.Add(c11); TestUserControl c111 = new TestUserControl(c11); Result theResult = A.Fake <Result>(); c1.Results.Add("theResult", theResult); c111.SetResult("theResult"); // context is the control, that contains matching Result A.CallTo(() => theResult.Navigate(c1)).MustHaveHappened(); }
public void SetResultSelectsCorrectResult() { MockRepository mocks = new MockRepository(); TestUserControl uc = new TestUserControl(); Result theResult = (Result)mocks.CreateMock(typeof(Result)); using (mocks.Ordered()) { theResult.Navigate(uc); } mocks.ReplayAll(); uc.Results.Add("theResult", theResult); uc.SetResult("theResult"); mocks.VerifyAll(); }
public void SetResultBubblesUpHierarchyUntilFirstMatch() { MockRepository mocks = new MockRepository(); TestUserControl c1 = new TestUserControl(); Control c11 = new Control(); c1.Controls.Add(c11); TestUserControl c111 = new TestUserControl(c11); Result theResult = (Result)mocks.CreateMock(typeof(Result)); using (mocks.Ordered()) { // context is the control, that contains matching Result theResult.Navigate(c1); } mocks.ReplayAll(); c1.Results.Add("theResult", theResult); c111.SetResult("theResult"); mocks.VerifyAll(); }