Ejemplo n.º 1
0
        public void Create_ShouldCall_OriginCreate()
        {
            var record = new SafeStartupRecord(_logger, _origin);

            record.Create();

            _origin.Received().Create();
        }
Ejemplo n.º 2
0
        public void Create_ShouldPass_Exception()
        {
            _origin.When(x => x.Create()).Do(_ => throw new Exception());
            var record = new SafeStartupRecord(_logger, _origin);

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

            action.Should().Throw <Exception>();
        }
Ejemplo n.º 3
0
        public void Create_ShouldSuppress_RegistryAccessException(Type exceptionType)
        {
            var exception = (Exception)Activator.CreateInstance(exceptionType);

            _origin.When(x => x.Create()).Do(_ => throw exception);
            var record = new SafeStartupRecord(_logger, _origin);

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

            action.Should().NotThrow();
        }