public void AddLocationWithoutName()
        {
            Mock <IImagesService> imagesServiceMock = new Mock <IImagesService>();

            imagesServiceMock
            .Setup(ls => ls.UploadImageAsync(new StreamMock()))
            .Returns(Task.FromResult("url"));

            using (ApplicationDbContext dbContext = serviceProvider.GetService <ApplicationDbContext>())
            {
                IConfiguration configuration = serviceProvider.GetService <IConfiguration>();

                LocationsService locationsService = new LocationsService(dbContext,
                                                                         serviceProvider.GetService <IMapper>(),
                                                                         configuration,
                                                                         imagesServiceMock.Object);

                AddLocationViewModel locationViewModel = new AddLocationViewModel
                {
                    Description = "LocationDescription",
                    TownId      = 1,
                };

                locationsService.AddAsync(locationViewModel).GetAwaiter().GetResult();

                int      locations           = dbContext.Locations.CountAsync().GetAwaiter().GetResult();
                Location locationWithoutName = dbContext.Locations.FirstAsync().GetAwaiter().GetResult();

                Assert.Equal(configuration["DefaultLocationName"], locationWithoutName.Title);

                Assert.True(locations == 1);
            }
        }
        public void AddLocationTest()
        {
            Mock <IImagesService> imagesServiceMock = new Mock <IImagesService>();

            imagesServiceMock
            .Setup(ls => ls.UploadImageAsync(new StreamMock()))
            .Returns(Task.FromResult("url"));

            using (ApplicationDbContext dbContext = serviceProvider.GetService <ApplicationDbContext>())
            {
                LocationsService locationsService = new LocationsService(dbContext,
                                                                         serviceProvider.GetService <IMapper>(),
                                                                         serviceProvider.GetService <IConfiguration>(),
                                                                         imagesServiceMock.Object);

                AddLocationViewModel locationViewModel = new AddLocationViewModel
                {
                    Title       = "LocationTitle",
                    Description = "LocationDescription",
                    TownId      = 1,
                };

                locationsService.AddAsync(locationViewModel).GetAwaiter().GetResult();

                Location location = dbContext.Locations.First();

                Assert.Equal(locationViewModel.Title, location.Title);
            }
        }