public void TryWithOnObjectWithExceptionImplicitArrayFails() { try { var source = new { Property1 = (string)null }; var result = source.TryWith(s => s.Property1.ToString(), typeof(OutOfMemoryException)); Assert.Fail("Exception must be thrown."); } catch (NullReferenceException) { } }
public void TryWithOnObjectWithExceptionImplicitArray() { var source = new { Property1 = (string)null }; var result = source.TryWith(s => s.Property1.ToString(), typeof(NullReferenceException)); Assert.AreEqual(null, result.Item1); Assert.IsInstanceOfType(result.Item2, typeof(NullReferenceException)); }