public async void Logout() { var testContext = TestContext.MockUp(); using (var domain0Context = new AuthenticationContext( domain0ClientEnvironment: testContext.ClientScopeMock.Object, externalStorage: testContext.LoginInfoStorageMock.Object)) { Assert.False(domain0Context.IsLoggedIn); var profile = await domain0Context.LoginByEmail("email", "2"); Assert.NotNull(profile); testContext.ClientScopeMock .VerifySet(callTo => callTo.Token = It.Is <string>(s => !string.IsNullOrWhiteSpace(s)), Times.Once); Assert.True(domain0Context.IsLoggedIn); domain0Context.Logout(); Assert.False(domain0Context.IsLoggedIn); testContext.ClientScopeMock .VerifySet(callTo => callTo.Token = It.Is <string>(s => string.IsNullOrWhiteSpace(s)), Times.Exactly(2)); testContext.LoginInfoStorageMock .Verify(callTo => callTo.Delete(), Times.Once); } }