Beispiel #1
0
        public void Returns_Default_If_ExceptionIsThrown()
        {
            int result;

            TryUtility.Try(FakeBuilder.FuncThrows <int>(), out result);
            result.Should().Be(default(int));
        }
Beispiel #2
0
        public void With_Success_Is_False_When_ExceptionIsThrown()
        {
            var  @try    = new Try <int>();
            bool success = @try.With(FakeBuilder.FuncThrows <int>());

            success.Should().Be(false);
        }
Beispiel #3
0
        public void Returns_False_If_ExceptionIsThrown()
        {
            int result;
            var success = TryUtility.Try(FakeBuilder.FuncThrows <int>(), out result);

            success.Should().Be(false);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
 public void DoesNotThrow()
 {
     try
     {
         new Try <int>(FakeBuilder.FuncThrows <int>());
     }
     catch
     {
         Assert.True(false, "Expected no exception from TryUtility, but got one");
     }
 }
Beispiel #8
0
 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");
     }
 }
Beispiel #9
0
        public void Object_Is_Default_When_ExceptionIsThrown()
        {
            int result = new Try <int>(FakeBuilder.FuncThrows <int>());

            result.Should().Be(default(int));
        }
Beispiel #10
0
        public void Success_Is_False_When_ExceptionIsThrown()
        {
            bool success = new Try <int>(FakeBuilder.FuncThrows <int>());

            success.Should().Be(false);
        }