public void CanStrictMockOnClassWithInternalMethod() { WithInternalMethod withInternalMethod = mocks.StrictMock <WithInternalMethod>(); withInternalMethod.Foo(); LastCall.Throw(new Exception("foo")); mocks.ReplayAll(); try { withInternalMethod.Foo(); Assert.False(true, "Should have thrown"); } catch (Exception e) { Assert.Equal("foo", e.Message); } }
public void CanStrictMockOnClassWithInternalMethod() { WithInternalMethod withInternalMethod = MockRepository.Partial <WithInternalMethod>(); withInternalMethod.Expect(x => x.Foo()) .Throws(new Exception("foo")); try { withInternalMethod.Foo(); Assert.False(true, "Should have thrown"); } catch (Exception e) { Assert.Equal("foo", e.Message); } }