public void ShouldNotUpdateTheCacheWhenFetchingFails() { var mockFetchRemoteConfigService = new MockFetchRemoteConfigService(false, true); UpdateRemoteConfigCacheService = new UpdateRemoteConfigCacheService(TimeService, KeyValueStorage, mockFetchRemoteConfigService); UpdateRemoteConfigCacheService.FetchAndStoreRemoteConfigData(); KeyValueStorage.DidNotReceive().SetInt(RatingViewDelayParameter, Arg.Any <int>()); KeyValueStorage.DidNotReceive().SetString(RatingViewTriggerParameter, Arg.Any <string>()); KeyValueStorage.DidNotReceive().SetBool(RegisterPushNotificationsTokenWithServerParameter, Arg.Any <bool>()); KeyValueStorage.DidNotReceive().SetBool(HandlePushNotificationsParameter, Arg.Any <bool>()); }
public void ShouldEmitWhenFetchAndStoreRemoteConfigDataSucceeds() { var testScheduler = new TestScheduler(); var observer = testScheduler.CreateObserver <Unit>(); var mockFetchRemoteConfigService = new MockFetchRemoteConfigService(shouldSucceed: true); UpdateRemoteConfigCacheService = new UpdateRemoteConfigCacheService(TimeService, KeyValueStorage, mockFetchRemoteConfigService); UpdateRemoteConfigCacheService.RemoteConfigChanged.Subscribe(observer); UpdateRemoteConfigCacheService.FetchAndStoreRemoteConfigData(); testScheduler.Start(); observer.Messages.Should().HaveCount(2); }
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); }