public async Task <ActionResult <HelloItem> > PostHelloItem(HelloItem helloItem)
        {
            _context.HelloItems.Add(helloItem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHelloItem", new { id = helloItem.Id }, helloItem));
        }
        public async Task <IActionResult> PutHelloItem(long id, HelloItem helloItem)
        {
            if (id != helloItem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(helloItem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HelloItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task ShouldResolveAggregateValidator()
        {
            var item = new HelloItem
            {
                FirstName   = "Bruce",
                LastName    = "Wayne",
                DateOfBirth = DateTime.Today.AddYears(-40)
            };

            var validator = this.container.GetInstance <IAggregateValidator <HelloItem> >();
            var result    = await validator.ValidateAsync(item);

            result.IsValid.ShouldBeFalse();
        }
        public async Task ShouldResolveFieldValidator_ShouldThrow()
        {
            var item = new HelloItem
            {
                FirstName   = "Bruce",
                LastName    = "Wayne",
                DateOfBirth = DateTime.Today.AddYears(-40)
            };

            var validator = this.container.GetInstance <IFieldValidator <HelloItem> >();
            var result    = await validator.ValidateAsync(item);

            result.IsValid.ShouldBeFalse();

            var ex = Should.Throw <ValidationException>(result.ThrowIfInvalid);

            ex.ValidationErrors.ShouldNotBeEmpty();
        }