public async Task CheckAddingSkinTypeAndNonExistingSkinProblemsToUserAsync() { ApplicationDbContext db = GetDb(); var repository = new EfDeletableEntityRepository <ApplicationUser>(db); var skinProblemsRepository = new EfDeletableEntityRepository <SkinProblem>(db); var clientSkinProblemsRepository = new EfRepository <ClientSkinProblem>(db); var service = new UsersService( repository, skinProblemsRepository, clientSkinProblemsRepository, this.cardsRepository.Object, this.cloudinaryService.Object); var skinType = new SkinType() { Id = "1" }; var firstSkinProblem = new SkinProblem() { Id = "1", Name = "first problem", }; var secondSkinProblem = new SkinProblem() { Id = "2", Name = "second problem", }; var thirdSkinProblem = new SkinProblem() { Id = "3", Name = "third problem", }; SkinProblem[] skinProblems = new SkinProblem[] { firstSkinProblem, secondSkinProblem, thirdSkinProblem, }; await db.SkinProblems.AddRangeAsync(skinProblems); await db.Users.AddAsync(this.client); await db.SkinTypes.AddAsync(skinType); await db.SaveChangesAsync(); string[] skinProblemsNames = new string[] { firstSkinProblem.Name, secondSkinProblem.Name, thirdSkinProblem.Name, }; await service.AddSkinTypeDataAsync(this.client.Id, true, skinType.Id, skinProblemsNames); await service.AddSkinTypeDataAsync(this.client.Id, true, skinType.Id, skinProblemsNames); Assert.True(this.client.IsSkinSensitive); Assert.Equal(3, this.client.ClientSkinProblems.Count()); }