public void Handle_Worker_Fallback() { // Act SomeWorker worker; bool baseExceptionWorksFlag, finallyWorksFlag; string result; // Action result = null; baseExceptionWorksFlag = false; worker = new SomeWorker(); try { worker.ExecuteDirty(); } catch (FallbackException fex) when(fex.InternalData != null) { result = (string)fex.InternalData; } catch (Exception) { baseExceptionWorksFlag = true; } finally { finallyWorksFlag = true; } // Assert Assert.NotNull(result); Assert.False(baseExceptionWorksFlag); Assert.True(finallyWorksFlag); }
public void Handle_Worker_Exception() { // Act SomeWorker worker; bool baseExceptionWorksFlag, finallyWorksFlag; string result; // Action result = null; baseExceptionWorksFlag = false; worker = new SomeWorker(); try { result = worker.ExecuteAtomic(); } catch (Exception) { baseExceptionWorksFlag = true; } finally { finallyWorksFlag = true; } // Assert Assert.True(baseExceptionWorksFlag); Assert.True(finallyWorksFlag); Assert.Null(result); }
public Task DoStuffAsync() { var worker = new SomeWorker(_ec); return(worker.WorkAsync()); }
public Samples() { worker = new SomeWorker(); }