public async Task ChangeFontStyleAsync_UserFontStyleChange_UsersFontStyleChanges(int userId, string fontStyle) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString); ICryptographyService cryptographyService = new CryptographyService(userAccountRepository); IAuthenticationService authenticationService = new AuthenticationService(userAccountRepository); IAccountSettingsService userAccountSettingsManager = new AccountSettingsService(userAccountRepository, userAccountSettingsRepository, cryptographyService, authenticationService); bool result = await userAccountSettingsManager.ChangeFontStyleAsync(userId, fontStyle); if (!result) { Assert.IsTrue(false); } string newFontStyle = await userAccountSettingsRepository.GetFontStyleByID(userId); if (fontStyle == newFontStyle) { Assert.IsTrue(true); } else { Assert.IsTrue(false); } }
public async Task ChangeFontStyleAsync_UserFontStyleChange_UsersFontStyleChanges(int userId, string fontStyle) { Mock <IUserAccountRepository> mockUserAccountRepository = new Mock <IUserAccountRepository>(); Mock <IUserAccountSettingsRepository> mockUserAccountSettingsRepository = new Mock <IUserAccountSettingsRepository>(); Mock <IAuthenticationService> mockAuthenticationService = new Mock <IAuthenticationService>(); Mock <ICryptographyService> mockCryptographyService = new Mock <ICryptographyService>(); IAccountSettingsService userAccountSettingsManager = new AccountSettingsService(mockUserAccountRepository.Object, mockUserAccountSettingsRepository.Object, mockCryptographyService.Object, mockAuthenticationService.Object); bool result = await userAccountSettingsManager.ChangeFontStyleAsync(userId, fontStyle); if (result == true) { Assert.IsTrue(true); } else { Assert.IsTrue(false); } }