Exemplo n.º 1
0
 public static string ToOtherInformationString(this OtherInformationDetails otherInformationDetailsObject)
 {
     return
         ($"|JudgeEmail|{otherInformationDetailsObject.JudgeEmail}" +
          $"|JudgePhone|{otherInformationDetailsObject.JudgePhone}" +
          $"|OtherInformation|{otherInformationDetailsObject.OtherInformation}");
 }
Exemplo n.º 2
0
        public void Should_Return_False_If_Judge_Email_is_null()
        {
            var otherInfo = new OtherInformationDetails {
                JudgeEmail = null
            };

            _hearing.OtherInformation = otherInfo.ToOtherInformationString();
            _hearing.DoesJudgeEmailExist().Should().BeFalse();
        }
Exemplo n.º 3
0
        public void Should_Return_True_If_Judge_Email_Exists()
        {
            var otherInfo = new OtherInformationDetails {
                JudgeEmail = "*****@*****.**"
            };

            _hearing.OtherInformation = otherInfo.ToOtherInformationString();

            _hearing.DoesJudgeEmailExist().Should().BeTrue();
        }
Exemplo n.º 4
0
        public void Should_Return_True_If_Judge_Phone_Exists()
        {
            var otherInfo = new OtherInformationDetails {
                JudgePhone = "1234564978"
            };

            _hearing.OtherInformation = otherInfo.ToOtherInformationString();

            _hearing.DoesJudgePhoneExist().Should().BeTrue();
        }
Exemplo n.º 5
0
        public void Should_Return_False_If_Judge_Has_Not_Changed_When_Comparing_Judge_Emails()
        {
            var otherInfo = new OtherInformationDetails {
                JudgeEmail = "*****@*****.**"
            };

            _hearing.OtherInformation = otherInfo.ToOtherInformationString();

            var hearing2 = new HearingDetailsResponse {
                Id = Guid.NewGuid()
            };
            var hearing2OtherInfo = new OtherInformationDetails {
                JudgeEmail = "*****@*****.**"
            };

            hearing2.OtherInformation = hearing2OtherInfo.ToOtherInformationString();

            _hearing.HasJudgeEmailChanged(hearing2).Should().BeFalse();
        }
Exemplo n.º 6
0
        private static OtherInformationDetails GetOtherInformationObject(string otherInformation)
        {
            try
            {
                var properties = otherInformation.Split("|");
                var otherInfo  = new OtherInformationDetails
                {
                    JudgeEmail = Array.IndexOf(properties, "JudgeEmail") > -1
                        ? properties[Array.IndexOf(properties, "JudgeEmail") + 1]
                        : "",
                    JudgePhone = Array.IndexOf(properties, "JudgePhone") > -1
                        ? properties[Array.IndexOf(properties, "JudgePhone") + 1]
                        : "",
                    OtherInformation = Array.IndexOf(properties, "OtherInformation") > -1
                        ? properties[Array.IndexOf(properties, "OtherInformation") + 1]
                        : ""
                };
                return(otherInfo);
            }
            catch (Exception)
            {
                if (string.IsNullOrWhiteSpace(otherInformation))
                {
                    {
                        return(new OtherInformationDetails {
                            OtherInformation = otherInformation
                        });
                    }
                }
                var properties = otherInformation.Split("|");
                if (properties.Length > 2)
                {
                    return(new OtherInformationDetails {
                        OtherInformation = properties[2]
                    });
                }

                return(new OtherInformationDetails {
                    OtherInformation = otherInformation
                });
            }
        }