public async Task CreateShouldReturnAddNewAdvertisementInDb()
        {
            // Arrange
            var db = this.Context;

            var advertisementsService = new AdvertisementService(db);
            var newName          = "sttttstststtststs";
            var newDescrtiption  = "sttttstststtststss";
            var newPrice         = 320m;
            var newPublishedDate = DateTime.ParseExact("01/01/2010", "dd/MM/yyyy", CultureInfo.InvariantCulture);
            var newCategoryId    = 4;
            var newUserId        = "geagaegaeagae";


            // Act
            await advertisementsService.Create(
                newName,
                newDescrtiption,
                newPrice,
                newPublishedDate,
                newCategoryId,
                newUserId);

            // Assert
            db
            .Advertisements
            .Where(a => a.Id == 1)
            .FirstOrDefault()
            .Should()
            .NotBe(null);

            db
            .Advertisements
            .Where(a => a.Id == 1)
            .Select(a => a.Name)
            .FirstOrDefault()
            .Should()
            .Be(newName);

            db
            .Advertisements
            .Where(a => a.Id == 1)
            .Select(a => a.Description)
            .FirstOrDefault()
            .Should()
            .Be(newDescrtiption);
        }
        public async Task <bool> HandleMessageAsync(string messageType, string message)
        {
            try
            {
                switch (messageType)
                {
                case "SellCar":
                    _advertisementService.Create(MessageSerializer.Deserialize <AdvertisementModel>(message));
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return(true);
        }
        public ActionResult <AdvertisementModel> Post([FromBody] AdvertisementModel ad)
        {
            var newAd = _advertisementService.Create(ad);

            return(Ok(JsonConvert.SerializeObject(newAd)));
        }