private static dataType CreateUserPreferences(string id, string userId, string theme, string language, string email) { var userPreferences = new dataType { Id = userId, UserId = userId, Theme = theme, Language = language, PreferredEmail = email, TimeZone = "UTC+3" }; return(userPreferences); }
public async void TestCrudOperations() { await _client.ClearUsersPreferencesAsync(null); // Create one user preferences dataType userPreferences1 = await _client.SetUserPreferencesAsync(null, USER_PREFERENCES1); Assert.NotNull(userPreferences1); Assert.Equal(USER_PREFERENCES1.Id, userPreferences1.Id); Assert.Equal(USER_PREFERENCES1.UserId, userPreferences1.UserId); // Create another userPreferences dataType userPreferences2 = await _client.SetUserPreferencesAsync(null, USER_PREFERENCES2); Assert.NotNull(userPreferences2); Assert.Equal(USER_PREFERENCES2.Id, userPreferences2.Id); Assert.Equal(USER_PREFERENCES2.UserId, userPreferences2.UserId); // Create another userPreferences dataType userPreferences3 = await _client.SetUserPreferencesAsync(null, USER_PREFERENCES3); Assert.NotNull(userPreferences3); Assert.Equal(USER_PREFERENCES3.Id, userPreferences3.Id); Assert.Equal(USER_PREFERENCES3.UserId, userPreferences3.UserId); // Get all users preferences DataPage <dataType> page = await _client.GetUsersPreferencesAsync(null, null, null); Assert.NotNull(page); Assert.NotNull(page.Data); Assert.Equal(3, page.Data.Count); // Update the user Preferences userPreferences1.UserId = "3"; dataType userPreferences = await _client.SetUserPreferencesAsync( null, userPreferences1 ); Assert.NotNull(userPreferences); Assert.Equal(userPreferences1.Id, userPreferences.Id); Assert.Equal("3", userPreferences.UserId); // Clear the user preferences userPreferences = await _client.ClearUserPreferencesAsync(null, userPreferences1); Assert.Null(userPreferences.Theme); }
public async Task <dataType> ClearUserPreferencesAsync(string correlationId, dataType userPreferences) { return(await this._controller.ClearUserPreferencesAsync(correlationId, userPreferences)); }