Пример #1
0
        public void ConditionalServiceResult_IsFailure_IfConditionSuccessful()
        {
            var result = new ConditionalServiceResult <string, ServiceResult <string> >(
                ServiceResult.FromResult("test"), ServiceResult.FromError("Failure"));

            result.ShouldBeFailure();
        }
Пример #2
0
        public void ConditionalServiceResult_HasResult_IfProvided()
        {
            var result = new ConditionalServiceResult <string, ServiceResult <string> >(
                ServiceResult.FromResult("test"), ServiceResult.FromSuccess());

            result.Result.ShouldBe("test");
        }
Пример #3
0
        public void ConditionalServiceResult_IsSuccessful_IfConditionSuccessful()
        {
            var result = new ConditionalServiceResult <string, ServiceResult <string> >(
                ServiceResult.FromResult("test"), ServiceResult.FromSuccess());

            result.ShouldBeSuccessful();
        }
Пример #4
0
        public void ResultFormatManager_ReturnsSpecializedFormatter_ForFailedConditionalResult()
        {
            var derivedResult = new DerivedServiceResult(false);
            var conditional   = new ConditionalServiceResult <string, ServiceResult <string> >
                                    (ServiceResult.FromResult(""), derivedResult);

            var result = ResultFormatManager.Format <ServiceResult, string>(conditional);

            result.ShouldStartWith(DerivedResultFormatter.Value);
        }