public void Create_ShouldCall_OriginCreate() { var record = new SafeStartupRecord(_logger, _origin); record.Create(); _origin.Received().Create(); }
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>(); }
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(); }