public static string ToOtherInformationString(this OtherInformationDetails otherInformationDetailsObject) { return ($"|JudgeEmail|{otherInformationDetailsObject.JudgeEmail}" + $"|JudgePhone|{otherInformationDetailsObject.JudgePhone}" + $"|OtherInformation|{otherInformationDetailsObject.OtherInformation}"); }
public void Should_Return_False_If_Judge_Email_is_null() { var otherInfo = new OtherInformationDetails { JudgeEmail = null }; _hearing.OtherInformation = otherInfo.ToOtherInformationString(); _hearing.DoesJudgeEmailExist().Should().BeFalse(); }
public void Should_Return_True_If_Judge_Email_Exists() { var otherInfo = new OtherInformationDetails { JudgeEmail = "*****@*****.**" }; _hearing.OtherInformation = otherInfo.ToOtherInformationString(); _hearing.DoesJudgeEmailExist().Should().BeTrue(); }
public void Should_Return_True_If_Judge_Phone_Exists() { var otherInfo = new OtherInformationDetails { JudgePhone = "1234564978" }; _hearing.OtherInformation = otherInfo.ToOtherInformationString(); _hearing.DoesJudgePhoneExist().Should().BeTrue(); }
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(); }
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 }); } }