public void passing_a_null_not_found_action_to_match_is_invalid()
        {
            var result = RemoveResult <object> .WasSuccess(new object());

            var act = (Action)(() => result.Match(v => { }, null));

            Assert.Throws <ArgumentNullException>(act);
        }
        public void passing_a_null_success_function_to_match_is_invalid()
        {
            var unit   = new object();
            var result = RemoveResult <object> .WasSuccess(new object());

            var act = (Action)(() => result.Match(null, () => unit));

            Assert.Throws <ArgumentNullException>(act);
        }
        public void passing_a_null_action_to_then_with_an_action_that_accepts_no_arguments_is_invalid()
        {
            var action = (Action)null;
            var result = RemoveResult <object> .WasSuccess(new object());

            var act = (Action)(() => result.Then(action));

            Assert.Throws <ArgumentNullException>(act);
        }
        public void passing_a_null_to_then_is_invalid()
        {
            var result = RemoveResult <object> .WasSuccess(new object());

            var act = (Action)(() => result.Then <object>(null));


            Assert.Throws <ArgumentNullException>(act);
        }
        public void can_create_a_success_result()
        {
            var expected = new object();
            var result   = RemoveResult <object> .WasSuccess(expected);

            result
            .Match(
                success: value => Assert.Equal(expected, value),
                notFound: () => Assert.False(true)
                );
        }
        public void then_with_an_action_that_accepts_no_arguments_will_apply_the_action_if_it_is_a_success()
        {
            var action_applied = false;
            var result         = RemoveResult <object> .WasSuccess(new object());


            result.Then(() => action_applied = true);


            Assert.True(action_applied);
        }
        public void then_with_an_action_that_accepts_no_arguments_returns_the_original_value()
        {
            var expected = new object();
            var result   = RemoveResult <object> .WasSuccess(expected);

            result
            .Then(() => { })
            .Match(
                success: value => Assert.Equal(expected, value),
                notFound: () => Assert.False(true)
                );
        }
        public void then_will_apply_the_transformation_if_it_is_a_success()
        {
            var expected = new object();
            var result   = RemoveResult <object> .WasSuccess(new object());

            result
            .Then(v => expected)
            .Match(
                success: value => Assert.Equal(expected, value),
                notFound: () => Assert.False(true)
                );
        }
        public void passing_a_null_success_value_is_not_valid()
        {
            var act = (Action)(() => RemoveResult <object> .WasSuccess(null));

            Assert.Throws <ArgumentNullException>(act);
        }