public async Task SaveAndRead() { //given string token = "test token"; TrustedSessionRepository session = new TrustedSessionRepository(); //when var file = await session.SaveAccessToken(token, "dummy"); //then Assert.IsNotNull(file); var readToken = await session.ReadAccessToken("dummy"); Assert.AreEqual(token, readToken); }
public async Task Read() { //given StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder; var file = await local.CreateFileAsync("token-file.txt", CreationCollisionOption.OpenIfExists); await file.DeleteAsync(); TrustedSessionRepository session = new TrustedSessionRepository(); //when try { await session.ReadAccessToken("none"); Assert.Fail("excption should have been thrown as there is no token saved yet"); } catch (Exception e) { //then Assert.IsTrue(e.Message.Contains("The system cannot find the file specified.")); } }