public void FromModel_NullAddress_ReturnsNewAddress() { var addressModel = new AddressModel(); var actualAddress = AddressExtensions.FromModel(null, addressModel); actualAddress.Should().NotBeNull(); }
public void CountryRegionName_CountryRegionFound_ReturnsName( List <CountryRegion> list ) { //Act string result = AddressExtensions.CountryRegionName( list[0].CountryRegionCode, list); //Assert result.Should().Be(list[0].Name); }
public void StateProvinceName_StateProvinceFound_ReturnsName( List <StateProvince> statesProvinces ) { //Act string result = AddressExtensions.StateProvinceName( statesProvinces[0].StateProvinceCode, statesProvinces ); //Assert result.Should().Be(statesProvinces[0].Name); }
public void CountryRegionName_CountryRegionNotFound_ThrowArgumentNullException( CountryRegion countryRegion ) { //Act Func <string> func = () => AddressExtensions.CountryRegionName( countryRegion.CountryRegionCode, new List <CountryRegion>() ); //Assert func.Should().Throw <ArgumentNullException>() .WithMessage("Value cannot be null. (Parameter 'country')"); }
public void StateProvinceName_StateProvinceNotFound_ThrowArgumentNullException( StateProvince stateProvince ) { //Act Func <string> func = () => AddressExtensions.StateProvinceName( stateProvince.StateProvinceCode, new List <StateProvince>() ); //Assert func.Should().Throw <ArgumentNullException>() .WithMessage("Value cannot be null. (Parameter 'stateProvince')"); }
public OperationResult CreateItem(AddressDto dto) { var parentPropertyName = dto.AddressItem.GetParentPropertyName(); var parentEl = DynamicGetFromRepository(parentPropertyName, dto.ParentId); var addressElement = AddressExtensions.CreateAddressElement(dto.AddressItem) .UpdateName(dto.Name) .UpdateParent(parentPropertyName, parentEl); var element = _repository.Create(addressElement); return(element == null ? new OperationResult(false, "Failed to create element.") : new OperationResult(true, element)); }
private void ValidateElectionCandidate(List <ElectionCandidate> electionCandidates) { List <string> invalidCandidates = new List <string>(); electionCandidates.ForEach(c => { if (!AddressExtensions.IsValidEthereumAddressHexFormat(c.Candidate)) { invalidCandidates.Add(c.Candidate); } }); if (invalidCandidates.Any()) { throw new Voting.Model.Exceptions.ValidationException( "آدرس وارد شده برای کاندیدا ها اشتباه است" + Environment.NewLine + string.Join(" , ", invalidCandidates)); } }
public void ToModel_NullAddress_ReturnsNull() { AddressExtensions.ToModel(null).Should().BeNull(); }
public static void ToDomain_NullModel_ReturnsNull() { AddressExtensions.ToDomain(null).Should().BeNull(); }