Esempio n. 1
0
        public void Exists_ShouldThrow_WhenOriginThrows()
        {
            _origin.Exists().Throws(new Exception());
            var record = new SafeStartupRecord(_logger, _origin);

            Action action = () => record.Exists();

            action.Should().Throw <Exception>();
        }
Esempio n. 2
0
        public void Exists_ShouldReturn_OriginExists(bool value)
        {
            _origin.Exists().Returns(value);
            var record = new SafeStartupRecord(_logger, _origin);

            var result = record.Exists();

            _origin.Received().Exists();
            result.Should().Be(value);
        }
Esempio n. 3
0
        public void Exists_ShouldReturnFalse_WhenOriginThrows_RegistryAccessException(Type exceptionType)
        {
            var exception = (Exception)Activator.CreateInstance(exceptionType);

            _origin.Exists().Throws(exception);
            var record = new SafeStartupRecord(_logger, _origin);

            var result = record.Exists();

            _origin.Received().Exists();
            result.Should().Be(false);
        }