コード例 #1
0
        public async Task AddPerson_ExpectedId()
        {
            var personHandler = new PersonHandler(BasicNeeds);

            var addPerson = new AddDefendant()
            {
                Birthdate      = new DateTime(1982, 10, 25),
                FirstName      = "Alex",
                Identification = "182084115982",
                IdentifierId   = 1,
                IdNumber       = "123123",
                IdSerie        = "TT",
                IsPerson       = true,
                Name           = "Albu",
                Nationality    = "Romana"
            };

            var viewmodel = await personHandler.Handle(addPerson, CancellationToken.None);

            var defendant = context.Persons.First(x => x.Identification == "182084115982");

            Assert.AreEqual(defendant.Id, viewmodel.Id);
        }
コード例 #2
0
        public ICommandResult Post([FromBody] CreatePersonCommand command)
        {
            var result = (CommandResult)_personHandler.Handle(command);

            return(result);
        }