public async Task SHOULD_save_new_handle()
        {
            //Act
            await Sut.UpdatePushNotificationServiceHandleAsync("new Handle");

            //Assert
            MockSecureStorageService.VerifySetAsyncCalled("PnsHandle", "new Handle");
        }
        public async Task IF_value_is_same_as_stored_one_SHOULD_not_save()
        {
            //Arrange
            MockSecureStorageService.Where_GetAsync_returns("stored Handle");

            //Act
            await Sut.UpdatePushNotificationServiceHandleAsync("stored Handle");

            //Assert
            MockSecureStorageService.Mock.Verify(x => x.SetAsync("PnsHandle", "stored Handle"), Times.Never);
        }
        public async Task IF_no_stored_handle_exists_SHOULD_return_empty_string_and_trace()
        {
            //Arrange
            MockSecureStorageService.Where_GetAsync_returns("PnsHandle", null);

            //Act
            var result = await Sut.GetPushNotificationServiceHandleAsync();

            //Assert
            Assert.AreEqual(string.Empty, result);
            MockAnalyticsService.VerifyTrace("No PnsHandle found");
        }
        public async Task IF_value_is_different_than_previous_one_SHOULD_log_analytics()
        {
            //Arrange
            MockSecureStorageService.Where_GetAsync_returns("new Handle");

            //Act
            await Sut.UpdatePushNotificationServiceHandleAsync("even newer Handle");

            //Assert
            MockAnalyticsService.VerifyTrace("PnsHandle updated", LogSeverity.Information);
            MockAnalyticsService.VerifyTraceProperty("OldPnsHandle", "new Handle");
            MockAnalyticsService.VerifyTraceProperty("NewPnsHandle", "even newer Handle");
        }
 public override void Setup()
 {
     base.Setup();
     Services.AddSingleton <TestPushNotificationsClientService>();
     MockSecureStorageService.Where_GetAsync_returns("PnsHandle", "stored handle");
 }