private static async Task ExpectToThrow()

in DeviceBridgeTests/Services/ConnectionManagerTests.cs [745:759]


        private static async Task ExpectToThrow(Func<Task> fn, Func<Exception, bool> exceptionTest = null)
        {
            try
            {
                await fn();
                Assert.Fail("Expected function to throw");
            }
            catch (Exception e)
            {
                if (exceptionTest != null && !exceptionTest(e))
                {
                    Assert.Fail("Exception didn't match test");
                }
            }
        }