public async Task UpdateProfileGoalsAsync_UpdateValue_ValueUpdated(int userId, string testValue) { Mock <IPublicUserProfileRepo> publicUserProfileRepo = new Mock <IPublicUserProfileRepo>(); Mock <IValidationService> validationService = new Mock <IValidationService>(); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo.Object, validationService.Object); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileService.CeatePublicUserProfileAsync(model); model.Goals = testValue; await publicUserProfileService.UpdateProfileGoalsAsync(model); Assert.IsTrue(true); } catch { Assert.IsTrue(false); } }
public async Task UpdateProfileGoalsAsync_UpdateValue_ValueUpdated(int userId, string testValue) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IPublicUserProfileRepo publicUserProfileRepo = new PublicUserProfileRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IPublicUserProfileService publicUserProfileService = new PublicUserProfileService(publicUserProfileRepo, validationService); PublicUserProfileModel model = new PublicUserProfileModel(); model.UserId = userId; try { await publicUserProfileService.CeatePublicUserProfileAsync(model); model.Goals = testValue; await publicUserProfileService.UpdateProfileGoalsAsync(model); IEnumerable <PublicUserProfileModel> models = await publicUserProfileRepo.GetAllPublicProfiles(); if (models == null) { Assert.IsTrue(false); } if (models.Count() == 0) { Assert.IsTrue(false); } foreach (var profile in models) { if (profile.Goals == testValue) { Assert.IsTrue(true); } else { Assert.IsTrue(false); } } } catch { Assert.IsTrue(false); } }