public async Task GetSessionStateAsyncShouldReturnStoredInLocalStorageWhenThereIsASessionInStorageThatHasNotBeenLoadedYetAsync() { // Arrange var user = new FluentSpotifyApi.Core.Model.PrivateUser { Id = "testuser" }; this.SecureStorage.SetItem(("testKey", user)); // Act + Assert (await this.AuthenticationManager.GetSessionStateAsync()).Should().Be(SessionState.StoredInLocalStorage); }
public async Task ShouldCallRestoreSessionAsyncMultipleTimesWithoutErrorAsync() { // Arrange var user = new FluentSpotifyApi.Core.Model.PrivateUser { Id = "testuser" }; this.SecureStorage.SetItem(("testKey", user)); // Act + Assert await this.AuthenticationManager.RestoreSessionAsync(); await this.AuthenticationManager.RestoreSessionAsync(); }
public async Task ShouldRestoreSessionFromStorageWhenRestoreSessionAsyncIsCalledAsync() { // Arrange var user = new FluentSpotifyApi.Core.Model.PrivateUser { Id = "testuser" }; this.SecureStorage.SetItem(("testKey", user)); // Act await this.AuthenticationManager.RestoreSessionAsync(); // Assert this.AuthenticationManager.GetUser().ShouldBeEquivalentTo(user); }
public async Task ShouldRemoveSessionFromStorageAsync() { // Arrange var user = new FluentSpotifyApi.Core.Model.PrivateUser { Id = "testuser" }; this.SecureStorage.SetItem(("testKey", user)); // Act await this.AuthenticationManager.RemoveSessionAsync(); // Assert this.SecureStorage.GetItem().Should().Be((null, null)); }
public async Task GetSessionStateAsyncShouldReturnCachedInMemoryWhenThereIsASessionInMemoryAsync() { // Arrange var user = new FluentSpotifyApi.Core.Model.PrivateUser { Id = "testuser" }; this.SecureStorage.SetItem(("testKey", user)); // Act await this.AuthenticationManager.RestoreSessionAsync(); var result = await this.AuthenticationManager.GetSessionStateAsync(); // Assert result.Should().Be(SessionState.CachedInMemory); }