Exemplo n.º 1
0
        public void And_Success_Is_True_When_BothTries_Are_Successful()
        {
            var  @try    = new Try <int>(FakeBuilder.FuncDoesNotThrow <int>());
            bool success = @try.And(FakeBuilder.FuncDoesNotThrow <int>());

            success.Should().Be(true);
        }
Exemplo n.º 2
0
        public void Returns_True_If_NoExceptionIsThrown()
        {
            int result;
            var success = TryUtility.Try(FakeBuilder.FuncDoesNotThrow <int>(), out result);

            success.Should().Be(true);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public void With_Success_Is_True_When_NoExceptionIsThrown()
        {
            var  @try    = new Try <int>();
            bool success = @try.With(FakeBuilder.FuncDoesNotThrow <int>());

            success.Should().Be(true);
        }
Exemplo n.º 5
0
        public void Object_Is_Value_When_NoExceptionIsThrown(
            [Frozen] IFixture fixture)
        {
            int result = new Try <int>(FakeBuilder.FuncDoesNotThrow <int>(fixture));

            result.Should().Be(fixture.Create <int>());
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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>());
        }
Exemplo n.º 8
0
        public void Success_Is_True_When_NoExceptionIsThrown()
        {
            bool success = new Try <int>(FakeBuilder.FuncDoesNotThrow <int>());

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