public void Returns_Default_If_ExceptionIsThrown() { int result; TryUtility.Try(FakeBuilder.FuncThrows <int>(), out result); result.Should().Be(default(int)); }
public void With_Success_Is_False_When_ExceptionIsThrown() { var @try = new Try <int>(); bool success = @try.With(FakeBuilder.FuncThrows <int>()); success.Should().Be(false); }
public void Returns_False_If_ExceptionIsThrown() { int result; var success = TryUtility.Try(FakeBuilder.FuncThrows <int>(), out result); success.Should().Be(false); }
public void And_Success_Is_False_When_OneTry_IsNot_Successful() { var @try = new Try <int>(FakeBuilder.FuncThrows <int>()); bool success = @try.And(FakeBuilder.FuncDoesNotThrow <int>()); success.Should().Be(false); }
public void Or_Success_True_When_OneTry_Is_Successful() { var @try = new Try <int>(FakeBuilder.FuncThrows <int>()); bool success = @try.Or(FakeBuilder.FuncDoesNotThrow <int>()); success.Should().Be(true); }
public void Or_Success_Is_False_When_BothTries_AreNot_Successful() { var @try = new Try <int>(FakeBuilder.FuncThrows <int>()); bool success = @try.Or(FakeBuilder.FuncThrows <int>()); success.Should().Be(false); }
public void DoesNotThrow() { try { new Try <int>(FakeBuilder.FuncThrows <int>()); } catch { Assert.True(false, "Expected no exception from TryUtility, but got one"); } }
public void DoesNotThrow() { try { int result; TryUtility.Try(FakeBuilder.FuncThrows <int>(), out result); } catch { Assert.True(false, "Expected no exception from TryUtility, but got one"); } }
public void Object_Is_Default_When_ExceptionIsThrown() { int result = new Try <int>(FakeBuilder.FuncThrows <int>()); result.Should().Be(default(int)); }
public void Success_Is_False_When_ExceptionIsThrown() { bool success = new Try <int>(FakeBuilder.FuncThrows <int>()); success.Should().Be(false); }