public void Handle(CreatePersonCommand command) { var person = new PersonDomain(command.Id, command.LastName, command.FirstName, command.Age); var aggregateId = -1; _domainRepository.Save(person, aggregateId); }
protected void Page_Load(object sender, EventArgs e) { PersonDomain pd = new PersonDomain(); GridView1.DataSource = pd.GetAllPeopleDataSet(); GridView1.DataBind(); }
// [ExpectedException(typeof(AssertFailedException))] public void ShouldFailForDifferentClasses() { var actual = new PersonDomain("John", "A"); var expected = new PersonDomain("John", "A"); PersonDomain person1 = new PersonDomain("John", "A"); PersonDomain person2 = new PersonDomain("John", "A"); Debug.WriteLine("Calling Equals:"); Debug.WriteLine(person1.Equals(person2)); Debug.WriteLine("\nCasting to an Object and calling Equals:"); Debug.WriteLine(((object)person1).Equals((object)person2)); AssertHelper.GetClassFields(typeof(PersonDomain)); AssertHelper.HasEqualFieldValues(expected, actual); }
static void Main(string[] args) { try { string recordCountStr = ConfigurationManager.AppSettings["RecordCount"]; int recordCount; if (!int.TryParse(recordCountStr, out recordCount)) { // default to 1000 if the value // cannot be read from the config recordCount = 1000; } PersonDomain pd = new PersonDomain(); pd.RegenerateData(recordCount); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public async Task GetPeopleFileWithIds_ValidTypeReturn_ReturnFileAsync() { // Arrange var mockMapper = new Mock <IMapper>(); var personDomain = new PersonDomain(mockMapper.Object); string test = "4567|arturo|perez|teleport engineering manager|Germany|Telecommunications|2|176"; byte[] byteArray = Encoding.ASCII.GetBytes(test); MemoryStream stream = new MemoryStream(byteArray); IFormFile file = new FormFile(stream, 0, stream.Length, null, "people.in"); // Act var result = await personDomain.GetPeopleFileWithIds(file); // Assert Assert.IsType <Response <FileOutputDTO> >(result); Assert.True(result.Status); Assert.Equal("people.out", result.Data.OutputFile.FileDownloadName); Assert.Equal("text/plain", result.Data.OutputFile.ContentType); }
public PersonController(PersonDbContext context) { _context = context; _domain = new PersonDomain(_context); }
static void Main(string[] args) { PersonDomain pd = new PersonDomain(); pd.RegenerateData(1000); }