diff --git a/Digipost.Api.Client.Domain/Utilities/DataTransferObjectConverter.cs b/Digipost.Api.Client.Domain/Utilities/DataTransferObjectConverter.cs index 8150545d..a7f0cc45 100755 --- a/Digipost.Api.Client.Domain/Utilities/DataTransferObjectConverter.cs +++ b/Digipost.Api.Client.Domain/Utilities/DataTransferObjectConverter.cs @@ -281,7 +281,7 @@ public static IIdentificationResult FromDataTransferObject(IdentificationResultD } else { - identificationResult = new IdentificationResult(identificationResultDto.IdentificationResultType, identificationResultDto.IdentificationValue as string); + identificationResult = new IdentificationResult(identificationResultDto.IdentificationResultType, identificationResultDto.IdentificationValue.ToString()); } return identificationResult; diff --git a/Digipost.Api.Client.Tests/Unittest/DtoTests/DataTransferObjectConverterTests.cs b/Digipost.Api.Client.Tests/Unittest/DtoTests/DataTransferObjectConverterTests.cs index 9dcc6adf..dc3252d2 100755 --- a/Digipost.Api.Client.Tests/Unittest/DtoTests/DataTransferObjectConverterTests.cs +++ b/Digipost.Api.Client.Tests/Unittest/DtoTests/DataTransferObjectConverterTests.cs @@ -489,7 +489,7 @@ public void IdentificationByPinReturnsUnidentifiedResultWithUnidentifiedReason() public void IdentificationByPinReturnsInvalidResultWithInvalidReason() { //Arrange - const string invalidValue = "InvalidPersonalIdentificationNumber"; + object invalidValue = InvalidReason.InvalidPersonalIdentificationNumber; IdentificationResultDataTransferObject source = new IdentificationResultDataTransferObject { IdentificationResultCode = IdentificationResultCode.Invalid, @@ -497,7 +497,7 @@ public void IdentificationByPinReturnsInvalidResultWithInvalidReason() IdentificationResultType = IdentificationResultType.InvalidReason }; - IdentificationResult expected = new IdentificationResult(IdentificationResultType.InvalidReason, invalidValue); + IdentificationResult expected = new IdentificationResult(IdentificationResultType.InvalidReason, invalidValue.ToString()); //Act var actual = DataTransferObjectConverter.FromDataTransferObject(source); @@ -562,7 +562,7 @@ public void IdentificationByAddressReturnsIdentifiedResultWithPersonalAliasResul public void IdentificationByAddressReturnsUnidentifiedResultWithUnidentifiedReason() { //Arrange - var reason = "NotFound"; + var reason = UnidentifiedReason.NotFound; IdentificationResultDataTransferObject source = new IdentificationResultDataTransferObject { IdentificationResultCode = IdentificationResultCode.Unidentified, @@ -570,7 +570,7 @@ public void IdentificationByAddressReturnsUnidentifiedResultWithUnidentifiedReas IdentificationResultType = IdentificationResultType.UnidentifiedReason }; - IdentificationResult expected = new IdentificationResult(IdentificationResultType.UnidentifiedReason, reason); + IdentificationResult expected = new IdentificationResult(IdentificationResultType.UnidentifiedReason, reason.ToString()); //Act var actual = DataTransferObjectConverter.FromDataTransferObject(source); @@ -625,7 +625,7 @@ public void IdentificationByOrganizationNumberReturnsIdentifiedResultWithPersonA public void IdentificationByOrganizationNumberReturnsUnidentifiedResultWithUnidentifiedReason() { //Arrange - var reason = "NotFound"; + var reason = UnidentifiedReason.NotFound; IdentificationResultDataTransferObject source = new IdentificationResultDataTransferObject { IdentificationResultCode = IdentificationResultCode.Unidentified, @@ -633,7 +633,7 @@ public void IdentificationByOrganizationNumberReturnsUnidentifiedResultWithUnide IdentificationResultType = IdentificationResultType.UnidentifiedReason }; - IdentificationResult expected = new IdentificationResult(IdentificationResultType.UnidentifiedReason, reason); + IdentificationResult expected = new IdentificationResult(IdentificationResultType.UnidentifiedReason, reason.ToString()); //Act var actual = DataTransferObjectConverter.FromDataTransferObject(source); @@ -648,7 +648,7 @@ public void IdentificationByOrganizationNumberReturnsUnidentifiedResultWithUnide public void IdentificationByOrganizationNumberReturnsInvalidResultWithInvalidReason() { //Arrange - const string invalidValue = "InvalidOrganisationNumber"; + object invalidValue = InvalidReason.InvalidOrganisationNumber; IdentificationResultDataTransferObject source = new IdentificationResultDataTransferObject { IdentificationResultCode = IdentificationResultCode.Invalid, @@ -656,7 +656,7 @@ public void IdentificationByOrganizationNumberReturnsInvalidResultWithInvalidRea IdentificationResultType = IdentificationResultType.InvalidReason }; - IdentificationResult expected = new IdentificationResult(IdentificationResultType.InvalidReason, invalidValue); + IdentificationResult expected = new IdentificationResult(IdentificationResultType.InvalidReason, invalidValue.ToString()); //Act var actual = DataTransferObjectConverter.FromDataTransferObject(source);