Example #1
0
        public PolicyException TryConvertException(Exception exp)
        {
            PolicyException res = null;

            try
            {
                res = ConvertException(exp);
            }
            catch (Exception e)
            {
            }
            return(res);
        }
Example #2
0
        public static bool IsEqual(this PolicyException @this, PolicyException other)
        {
            // PolicyException is stubbed out in Core therefore we are skipping some equality checks.

            return(@this != null &&
                   other != null &&
                   // On full framework, line number may be method body start
                   // On Net Native we can't reflect on Exceptions and change its StackTrace
                   ((PlatformDetection.IsFullFramework || PlatformDetection.IsNetNative) ? true :
                    (@this.StackTrace == other.StackTrace &&
                     @this.ToString() == other.ToString())) &&
                   @this.Data.CheckSequenceEquals(other.Data) &&
                   @this.Source == other.Source &&
                   @this.HelpLink == other.HelpLink &&
                   CheckEquals(@this.InnerException, other.InnerException));
        }
        public void Entity_To_Model_IsValid()
        {
            var exceptionKey   = "TestException1";
            var exceptionValue = "Test Exception One";
            var entity         = new PolicyException
            {
                CostImplication = "A cost implication",
                Id = Guid.NewGuid(),
                CostStageRevisionId = Guid.NewGuid(),
                ExceptionType       = new dataAccess.Entity.DictionaryEntry
                {
                    Key   = exceptionKey,
                    Value = exceptionValue
                },
                Reason = "A valid reason",
                Status = PolicyExceptionStatus.Approved
            };

            entity.CreatedInRevisionId = entity.CostStageRevisionId;
            var result = _mapper.Map <PolicyException, core.Models.PolicyExceptions.PolicyException>(entity);

            result.Should().NotBeNull();
            result.CostImplication.Should().NotBeNull();
            result.CostImplication.Should().Be(entity.CostImplication);
            result.ExceptionType.Should().NotBeNull();
            result.ExceptionType.Key.Should().Be(exceptionKey);
            result.ExceptionType.Value.Should().Be(exceptionValue);
            result.Id.Should().HaveValue();
            result.Id.Should().Be(entity.Id);
            result.CostStageRevisionId.Should().Be(entity.CostStageRevisionId);
            result.CreatedInRevisionId.Should().Be(entity.CreatedInRevisionId);
            result.Reason.Should().NotBeNull();
            result.Reason.Should().Be(entity.Reason);
            result.Status.Should().NotBeNull();
            result.Status.Key.Should().NotBeNull();
            result.Status.Key.Should().Be(PolicyExceptionStatus.Approved.ToString());
        }
Example #4
0
        public static void PolicyExceptionCallMethods()
        {
            PolicyException pe = new PolicyException();

            pe = new PolicyException("test");
        }
 internal IndexPolicyException(PolicyException pe) : base(pe.Message, pe)
 {
     m_nIndex = -1;
 }