public async void GetAllByUserId_ShouldReturnAllUsersAddressesByUserId()
        {
            var options = new DbContextOptionsBuilder <TechAndToolsDbContext>()
                          .UseInMemoryDatabase(databaseName: "GetAllByUserId_ShouldReturnAllUsersAddressesByUserId")
                          .Options;

            TechAndToolsDbContext context = new TechAndToolsDbContext(options);

            await SeedData(context);

            IUserService    userService    = new UserService(context);
            IAddressService addressService = new AddressService(context, userService);

            TechAndToolsUser testUser = new TechAndToolsUser
            {
                Id       = "testId",
                UserName = "******",
                Email    = "testEmail"
            };

            await context.AddAsync(testUser);

            await context.SaveChangesAsync();

            int expectedResult = context.Addresses.Where(x => x.TechAndToolsUserId == "testId").ToList().Count;
            int actualResult   = addressService.GetAllByUserId("testId").ToList().Count;

            Assert.Equal(expectedResult, actualResult);
        }
        public async void CreateAsync_WithIncorrectUserShouldThrowException()
        {
            var options = new DbContextOptionsBuilder <TechAndToolsDbContext>()
                          .UseInMemoryDatabase(databaseName: "CreateAsync_WithIncorrectUserShouldThrowException")
                          .Options;

            TechAndToolsDbContext context        = new TechAndToolsDbContext(options);
            IUserService          userService    = new UserService(context);
            IAddressService       addressService = new AddressService(context, userService);

            TechAndToolsUser testUser = new TechAndToolsUser
            {
                UserName = "******",
                Email    = "testEmail"
            };

            await context.AddAsync(testUser);

            await context.SaveChangesAsync();


            AddressServiceModel serviceModel = new AddressServiceModel
            {
                Id                 = 1,
                City               = "CityTest1",
                CityAddress        = "CityAddressTest1",
                PostCode           = 9000,
                TechAndToolsUserId = Guid.NewGuid().ToString()
            };

            await Assert.ThrowsAsync <ArgumentNullException>(() => addressService.CreateAsync(serviceModel, "wrongUsername"));
        }
        public async void CreateAsync_ShouldCreateAndAddAddressToDatabase()
        {
            var options = new DbContextOptionsBuilder <TechAndToolsDbContext>()
                          .UseInMemoryDatabase(databaseName: "CreateArticleAsync_ShouldCreateAndAddArticlesToDatabase")
                          .Options;

            TechAndToolsDbContext context        = new TechAndToolsDbContext(options);
            IUserService          userService    = new UserService(context);
            IAddressService       addressService = new AddressService(context, userService);

            TechAndToolsUser testUser = new TechAndToolsUser
            {
                UserName = "******",
                Email    = "testEmail"
            };

            await context.AddAsync(testUser);

            await context.SaveChangesAsync();

            await addressService.CreateAsync(
                new AddressServiceModel
            {
                Id                 = 1,
                City               = "CityTest1",
                CityAddress        = "CityAddressTest1",
                PostCode           = 9000,
                TechAndToolsUserId = Guid.NewGuid().ToString()
            }, "testUsername");

            await addressService.CreateAsync(
                new AddressServiceModel
            {
                Id                 = 2,
                City               = "CityTest2",
                CityAddress        = "CityAddressTest2",
                PostCode           = 9000,
                TechAndToolsUserId = Guid.NewGuid().ToString()
            }, "testUsername");

            int expectedCount = 2;

            int actualCount = context.Addresses.ToList().Count;

            Assert.Equal(expectedCount, actualCount);
        }