Beispiel #1
0
        public void success_of_nothing_has_a_shortcut()
        {
            var result = PartialResult.Success();

            Assert.That(result.State, Is.EqualTo(PartialResultState.Success));
            Assert.That(result.ResultData, Is.EqualTo(Nothing.Instance));
        }
Beispiel #2
0
        public void can_create_a_success_result_and_read_it_back()
        {
            var result = PartialResult.Success(1);

            Assert.That(result.IsSuccess, Is.True, "Should have been success, but was not");
            Assert.That(result.IsFailure, Is.False, "Should NOT have been failure, but was");
            Assert.That(result.State, Is.EqualTo(PartialResultState.Success), $"Should have been 'complete', but was '{result.State}'");

            Assert.That(result.ResultData, Is.EqualTo(1), "Stored data was incorrect");
        }
Beispiel #3
0
        public void adding_success_and_failure_results_in_failure()
        {
            var result_1 = PartialResult <int> .Success(1).Failure("err");

            var result_2 = PartialResult.Success(2).Failure("fail");
            var result_3 = PartialResult <int> .Failure("fail").Success(1);

            Assert.That(result_1.State, Is.EqualTo(PartialResultState.Failed));
            Assert.That(result_2.State, Is.EqualTo(PartialResultState.Failed));
            Assert.That(result_3.State, Is.EqualTo(PartialResultState.Failed));
        }