public void SetResultSelectsCorrectResult() { MockRepository mocks = new MockRepository(); TestPage page = new TestPage(); Result theResult = (Result) mocks.CreateMock(typeof (Result)); theResult.Navigate(page); mocks.ReplayAll(); page.Results.Add( "theResult", theResult ); page.SetResult("theResult"); mocks.VerifyAll(); }
public void SetResultThrowsVerboseExceptionOnUnknownResultName() { string RESULTNAME = "nonexistant result"; TestPage page = new TestPage(); try { page.SetResult(RESULTNAME); Assert.Fail(); } catch(ArgumentException ae) { string expected = string.Format("No mapping found for the specified destination '{0}'.", RESULTNAME); string msg = ae.Message.Substring(0, expected.Length); Assert.AreEqual(expected, msg); } }