public void ValidateSetsDefaultVariables() { TestPage page = new TestPage(HttpContext.Current); TestUserControl c1 = new TestUserControl(); page.Controls.Add(c1); ConditionValidator v1 = new ConditionValidator("#page == #this.Page", null); ConditionValidator v2 = new ConditionValidator("#usercontrol == #this", null); Assert.IsTrue(c1.Validate(c1, v1, v2)); }
public void StoresAndRetrievesModelItem() { TestSessionModelPersistenceMedium pm = new TestSessionModelPersistenceMedium(); Control tuc = new TestUserControl("TucID"); pm.SaveToMedium( tuc, this ); // ensure key was generated by GetKey() and Item was added to storage Assert.AreEqual( this, pm.SessionItems["TucID"] ); // ensure key was generated by GetKey() and Item is retrieved from storage Assert.AreEqual( this, pm.LoadFromMedium( tuc ) ); }
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(); }
public void NoNullModelPersistenceMediumAllowed() { TestUserControl tuc = new TestUserControl(); tuc.ModelPersistenceMedium = null; }
public void StoresAndLoadsModelUsingModelPersistenceMedium() { TestUserControl tuc = new TestUserControl(); tuc.ModelPersistenceMedium = new DictionaryModelPersistenceMedium(); tuc.SaveModelToPersistenceMedium( this ); Assert.AreEqual(this, tuc.LoadModelFromPersistenceMedium()); }
public void NoNullModelPersistenceMediumAllowed() { TestUserControl tuc = new TestUserControl(); Assert.Throws<ArgumentNullException>(() => tuc.ModelPersistenceMedium = null); }