public static PushNotificationsConfiguration GetConfiguration(Item configItem) { var config = new PushNotificationsConfiguration(); config.MailTo = configItem.Fields[SF.Foundation.PushNotifications.Constants.FieldIds.MailTo].Value; config.PrivateKey = configItem.Fields[SF.Foundation.PushNotifications.Constants.FieldIds.PrivateKey].Value; config.PublicKey = configItem.Fields[SF.Foundation.PushNotifications.Constants.FieldIds.PublicKey].Value; config.GoogleAPIKey = configItem.Fields[SF.Foundation.PushNotifications.Constants.FieldIds.GoogleAPIKey].Value; return(config); }
public MockFetchRemoteConfigService( bool shouldSucceed = true, bool shouldFail = false, Exception exceptionOnFailure = null, RatingViewConfiguration ratingViewConfigurationToReturn = default(RatingViewConfiguration), PushNotificationsConfiguration pushNotificationsConfigurationReturn = default(PushNotificationsConfiguration)) { this.shouldSucceed = shouldSucceed; this.shouldFail = shouldFail; this.exceptionOnFailure = exceptionOnFailure; this.ratingViewConfigurationToReturn = ratingViewConfigurationToReturn; this.pushNotificationsConfigurationReturn = pushNotificationsConfigurationReturn; }
public void ShouldUpdateTheCacheWhenFetchingSucceeds(int ratingViewDayCount, RatingViewCriterion ratingViewCriterion, bool registerPushes, bool handlePushes) { var expectedRatingViewConfiguration = new RatingViewConfiguration(ratingViewDayCount, ratingViewCriterion); var expectedPushNotificationsConfiguration = new PushNotificationsConfiguration(registerPushes, handlePushes); var mockFetchRemoteConfigService = new MockFetchRemoteConfigService( true, ratingViewConfigurationToReturn: expectedRatingViewConfiguration, pushNotificationsConfigurationReturn: expectedPushNotificationsConfiguration); UpdateRemoteConfigCacheService = new UpdateRemoteConfigCacheService(TimeService, KeyValueStorage, mockFetchRemoteConfigService); UpdateRemoteConfigCacheService.FetchAndStoreRemoteConfigData(); KeyValueStorage.Received().SetInt(RatingViewDelayParameter, ratingViewDayCount); KeyValueStorage.Received().SetString(RatingViewTriggerParameter, ratingViewCriterion.ToString()); KeyValueStorage.Received().SetBool(RegisterPushNotificationsTokenWithServerParameter, registerPushes); KeyValueStorage.Received().SetBool(HandlePushNotificationsParameter, handlePushes); }