public async Task UpdateAddressShouldUpdateAddress() { var dbContext = ApplicationDbContextInMemoryFactory.InitializeContext(); var repository = new EfDeletableEntityRepository <UserAddress>(dbContext); var service = new AddressesService(repository); var userManager = MockUserManager.GetUserManager(); // Create var user = new ApplicationUser { Email = "*****@*****.**", UserName = "******", }; await userManager.CreateAsync(user); var userAddress = new UserAddress() { UserId = user.Id, PersonName = "User", Area = "ValidArea", Street = "ValidStreet", Building = "ValidBuilding", Floor = "ValidFloor", Apartment = "ValidApartment", PhoneNumber = "ValidNumber", }; await service.CreateAsync(userAddress); // Update userAddress.PersonName = "UpdatedUser"; userAddress.Area = "UpdatedValidArea"; userAddress.Street = "UpdatedValidStreet"; userAddress.Building = "UpdatedValidBuilding"; userAddress.Floor = "UpdatedValidFloor"; userAddress.Apartment = "UpdatedValidApartment"; userAddress.PhoneNumber = "UpdatedValidNumber"; await service.UpdateAsync(userAddress); var updatedAddress = dbContext.Addresses.ToList().Find(x => x.Id == userAddress.Id); Assert.Equal("UpdatedUser", updatedAddress.PersonName); Assert.Equal("UpdatedValidArea", updatedAddress.Area); Assert.Equal("UpdatedValidStreet", updatedAddress.Street); Assert.Equal("UpdatedValidBuilding", updatedAddress.Building); Assert.Equal("UpdatedValidFloor", updatedAddress.Floor); Assert.Equal("UpdatedValidApartment", updatedAddress.Apartment); Assert.Equal("UpdatedValidNumber", updatedAddress.PhoneNumber); }