Example #1
0
        public void ShouldLogErrorIfLoadFails()
        {
            var exception = new Exception("error");

            _mockLog.Setup(log => log.ReadAll()).Throws(exception);

            WhenEventViewModelsAreLoaded();

            _mockLogger.Verify(l => l.Error(ItIsException.With("could not read log", exception)));
        }
Example #2
0
        public void ShouldDisplayNothingAndLogErrorWhenRefreshFails()
        {
            var exception = new AssertException("test exception");

            _mockLogManager.Setup(lm => lm.Logs).Throws(exception);

            WhenViewModelIsRefreshed();

            Assert.IsEmpty(_uut.Sessions);
            _mockLogger.Verify(l => l.Error(ItIsException.With("refresh failed", exception)));
        }