public void DoOrThrow() { var target = new ConcurrentIndexed <int, string>(); Assert.ThrowsAny <Exception>(() => target.DoOrThrow(1, x => x + "!")); target.AddOrThrow(1, "1"); target.DoOrThrow(1, x => x + "!"); Assert.Equal("1!", target.GetOrThrow(1)); }
public void DoOrThrow_Func() { var target = new ConcurrentIndexed <int, string>(); Assert.ThrowsAny <Exception>(() => target.DoOrThrow(1, x => x + "!")); target.AddOrThrow(1, "1"); string s = null; target.DoOrThrow(1, x => { s = x + "!"; return(x); }); Assert.Equal("1!", s); }