Code Cleanup | Format Document | Insert Snippet | Surround With |
---|---|---|---|
Ctrl+K, Ctrl+E |
Ctrl+K, Ctrl+D |
Ctrl+K, Ctrl+X |
Ctrl+K, Ctrl+S |
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 Lead | |
{ | |
public string Name { get; set; } | |
public string Email { get; set; } | |
public IList<Segment> Segments { get; set; } | |
public string Company { get; set; } |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace DddBuildingBlocks.Domain.CapturarLeadsContext | |
{ | |
public class Lead : Entity | |
{ | |
private readonly List<Segment> _segments = new List<Segment>(); |
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 Lead | |
{ | |
// The minimum data needed to create a Lead instance. | |
// The name and e-mail are the minimum necessary for a Lead to exist. Remember? | |
public Lead(string name, string email) | |
{ | |
Name = name; | |
Email = email; | |
} | |
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 Lead | |
{ | |
// Initializing Segments to avoid an exception. | |
public Lead(string name, string email) | |
{ | |
Name = name; | |
Email = email; | |
_segments = new List<Segment>(); | |
} | |
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 Lead | |
{ | |
public Lead(string name, string email) | |
{ | |
Name = name; | |
Email = email; | |
_segments = new List<Segment>(); | |
} | |
public string Name { get; } |
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 Name | |
{ | |
public Name(string firstName, string lastName = "") | |
{ | |
Guard.Against.NullOrWhiteSpace(firstName, nameof(firstName)); | |
FirstName = firstName; | |
LastName = lastName; | |
} |
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 PhoneNumber | |
{ | |
public PhoneNumber(string ddd, string number) | |
{ | |
Guard.Against | |
.NotMatch(ddd, @"^\d{2}$", nameof(ddd)) | |
.NotMatch(number, @"^\d{8}$|^\d{9}$", nameof(number)); | |
Ddd = ddd; | |
Number = number; |
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)); |
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
[Trait("Category", nameof(Domain))] | |
public class PhoneNumberTest | |
{ | |
[Theory] | |
[InlineData("11")] | |
[InlineData("51")] | |
public void PhoneNumber_ValidDdd_Valid(string ddd) | |
{ | |
Assert.DoesNotThrows(() => new PhoneNumber(ddd, "25615006")); | |
} |
OlderNewer