public void Creating_a_result_failure_has_an_error_message()
        {
            var result = ResultSimple.Fail <MyClass1>("ups");

            result.IsFailure.Should().BeTrue();
            result.Error.Should().Be("ups");
        }
        public void OnFailure_with_failure_runs_action()
        {
            var myBool   = false;
            var myresult = ResultSimple.Fail <MyClass>("ups");

            myresult.OnFailure(error => myBool = true);
            myBool.Should().BeTrue();
        }
        public void OnSuccess_with_failure_returns_error()
        {
            var myresult = ResultSimple.Fail <MyClass>("ups");
            var result   = myresult
                           .OnSuccess(x => ResultSimple.Ok(new MyClass {
                Property = "changed"
            }));

            result.Error.Should().Be("ups");
        }
        public void OnBoth_with_failure_runs_function()
        {
            var myresult = ResultSimple.Fail <MyClass>("ups");
            var result   = myresult
                           .OnBoth(x => x.IsFailure
                    ? new Dummy {
                Name = x.Error
            }
                    : new Dummy {
                Name = x.Value.Property
            });

            result.Name.Should().Be("ups");
        }