Exemple #1
0
        public void Returns_Value_If_NoExceptionIsThrown(
            [Frozen] IFixture fixture)
        {
            int result;

            TryUtility.Try(FakeBuilder.FuncDoesNotThrow <int>(fixture), out result);
            result.Should().Be(fixture.Create <int>());
        }
Exemple #2
0
 public void DoesNotThrow()
 {
     try
     {
         TryUtility.Try(FakeBuilder.ActionThrows());
     }
     catch
     {
         Assert.True(false, "Expected no exception from TryUtility, but got one");
     }
 }
Exemple #3
0
 public void DoesNotThrow()
 {
     try
     {
         new Try <int>(FakeBuilder.FuncThrows <int>());
     }
     catch
     {
         Assert.True(false, "Expected no exception from TryUtility, but got one");
     }
 }
Exemple #4
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");
     }
 }
Exemple #5
0
        public void Returns_False_If_ExceptionIsThrown()
        {
            var success = TryUtility.Try(FakeBuilder.ActionThrows());

            success.Should().Be(false);
        }
Exemple #6
0
        public void Returns_True_If_NoExceptionIsThrown()
        {
            var success = TryUtility.Try(FakeBuilder.ActionDoesNotThrow());

            success.Should().Be(true);
        }
Exemple #7
0
 public void Customize(IFixture fixture)
 {
     fixture.Register(() => FakeBuilder.GetInt());
 }
Exemple #8
0
        public void Success_Is_False_When_ExceptionIsThrown()
        {
            bool @try = new Try(FakeBuilder.ActionThrows());

            @try.Should().Be(false);
        }
Exemple #9
0
        public void Success_Is_True_When_NoExceptionIsThrown()
        {
            bool success = new Try(FakeBuilder.ActionDoesNotThrow());

            success.Should().Be(true);
        }
Exemple #10
0
        public void Object_Is_Default_When_ExceptionIsThrown()
        {
            int result = new Try <int>(FakeBuilder.FuncThrows <int>());

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

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