Last active
June 20, 2023 15:15
-
-
Save maiconheck/810e2cf01a4d38e694d29758d8fcaa53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Address | |
{ | |
public Address(string zipCode, string street, int number, string neighborhood, string complement = "") | |
{ | |
Guard.Against | |
.NotMatch(zipCode, @"^\d{5}-\d{3}$", nameof(zipCode)) | |
.NullOrWhiteSpace(street, nameof(street)) | |
.ZeroOrLess(number, nameof(number)) | |
.NullOrWhiteSpace(neighborhood, nameof(neighborhood)); | |
ZipCode = zipCode; | |
Street = street; | |
Number = number; | |
Neighborhood = neighborhood; | |
Complement = complement; | |
} | |
public string ZipCode { get; } | |
public string Street { get; } | |
public int Number { get; } | |
public string Neighborhood { get; } | |
public string Complement { get; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment