public void SoftlyAssert_ManyFailures() { Action sa = () => SafeActions.Safely(ManyFailureActions(Tested)); sa.Should().Throw <SafeActionsException>().WithMessage(Message_ManyFailures); Tested.Value.Should().BeTrue(); }
public void SoftlyAssert_Pass() { Action sa = () => SafeActions.Safely(PassingActions(Tested)); sa.Should().NotThrow(); Tested.Value.Should().BeTrue(); }
/// <summary> /// Configures this instance. /// </summary> public void Configure() { // not sure on this, but i consider it (the load) a critical section while (!Synchronise.Start()) { Synchronise.WaitTillReady(); } var loadPath = GetLoadPath(); if (!File.Exists(loadPath)) { Console.Publish($"File not found: {loadPath}"); Synchronise.Finish(); return; } // TODO: fix this, not the right method of flow control, but stops the auto reset holding up the load if we get a de-serialisation error SafeActions.Try(() => { Initialise(loadPath); PerformHealthCheck(); PerformSupplmentalLoad(Configured as TConcrete); }); Synchronise.Finish(); }
public void SetUp() { Actions = new SafeActions(); Tested = new BooleanHolder() { Value = false }; }
public void FailureHandler_Executed() { BooleanHolder handlerHolder = new BooleanHolder() { Value = false }; void failureHandler(Exception e) => handlerHolder.Value = true; Actions = new SafeActions(failureHandler); Actions.Attempt(OneFailureActions(Tested)); handlerHolder.Value.Should().BeTrue(); }
public void Drop() { SafeActions.Try(() => SQLDatabase.Execute(GetDropTableSQL())); }
public static void DropTable(string tableName) { SafeActions.Try(() => Execute($"drop table [{tableName}]")); }