public async Task <IHttpActionResult> CreateLotAsync(LotDTO lot)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            lot.UserName = User.Identity.Name;
            var createdLot = await _lotsService.CreateLotAsync(lot);

            return(Created(Request.RequestUri + "/" + createdLot?.LotId, createdLot));
        }
        public async Task CreateLotAsync_CreateLotWithoutImage_CreatedLotReturned()
        {
            var lot = new LotDTO()
            {
                BeginDate    = DateTime.Now,
                EndDate      = DateTime.Now.AddDays(2),
                InitialPrice = 10,
                Name         = "Lot 3",
                LotId        = 2,
                UserName     = "******",
                Category     = new CategoryDTO()
                {
                    CategoryId = 1
                }
            };

            _mockUnitWork.Setup(x => x.UserProfiles.FindAsync(It.IsAny <Expression <Func <UserProfile, bool> > >(), 10, 0))
            .ReturnsAsync((Items: new List <UserProfile>()
            {
                new UserProfile()
            }, TotalCount: _lots.Count));
            _mockUnitWork.Setup(x => x.Categories.GetAsync(lot.Category.CategoryId)).ReturnsAsync(new Category());
            _mockUnitWork.Setup(x => x.Lots.GetAsync(lot.LotId)).ReturnsAsync(new Lot()
            {
                BeginDate    = DateTime.Now,
                EndDate      = DateTime.Now.AddDays(2),
                InitialPrice = 10,
                Name         = "Lot 3",
                LotId        = 2,
                UserId       = 1,
                CategoryId   = 1
            });
            _mockUnitWork.Setup(x => x.Lots.Create(It.IsAny <Lot>()));

            var createdLot = await _service.CreateLotAsync(lot);

            Assert.That(createdLot, Is.Not.Null);
            Assert.That(createdLot.LotId, Is.EqualTo(lot.LotId));
        }