Beispiel #1
0
        public void ShouldCallDisposeInFunctionalWay()
        {
            var called = false;
            Func <CanBeDispose, bool> action = _ => called = true;
            var log        = new Mock <ILog>();
            var disposable = new CanBeDispose(log.Object);

            Using(disposable, action);

            Assert.IsTrue(called);
            log
            .Verify(m => m.Log("dispose"), Times.Once);
        }
Beispiel #2
0
        public void ShouldCallDisposeInRawMode()
        {
            var    called     = false;
            Action action     = () => called = true;
            var    log        = new Mock <ILog>();
            var    disposable = new CanBeDispose(log.Object);

            Raw(disposable, action);

            Assert.IsTrue(called);
            log
            .Verify(m => m.Log("dispose"), Times.Once);
        }