コード例 #1
0
        public void GoodExplanationForUsingReturnAndRepeatNever()
        {
            ILogWriter eventLogMock = MockRepository.Mock <ILogWriter>();
            Log        log          = new Log(null, eventLogMock, "MOCK", true, false);

            eventLogMock.Expect(x => x.WriteLog(EventLogEntryType.SuccessAudit, "MOCK", null, null, 0))
            .Return(true);

            Assert.Throws <InvalidOperationException>(
                () => eventLogMock.Expect(x => x.WriteLog(EventLogEntryType.FailureAudit, "MOCK", null, null, 0))
                .Return(true)
                .Repeat.Never());
        }