public async Task LogoffFlowTest(string token, string device, bool callCloseCount) { var tokenRep = TokenRepositoryMock.CreateRepository(); try { await Logoff.Execute(tokenRep, token, device); Assert.AreEqual(tokenRep.CloseCount, callCloseCount ? 1 : 0); } catch { Assert.AreEqual(tokenRep.CloseCount, callCloseCount ? 1 : 0); } }
public async Task LogoffCodeTest(string token, string device, bool exception, Type exceptionType = null) { var tokenRep = TokenRepositoryMock.CreateRepository(); try { await Logoff.Execute(tokenRep, token, device); Assert.IsFalse(exception); } catch (Exception ex) { Assert.IsTrue((exception) && (exceptionType.FullName == ex.GetType().FullName)); } }
public async Task LogoffInvalidParametersTest(bool isTokenRepNull, string token, string device) { var tokenRep = isTokenRepNull ? null : TokenRepositoryMock.CreateRepository(); try { await Logoff.Execute(tokenRep, token, device); Assert.Fail(); } catch (Exception ex) { if (isTokenRepNull) { Assert.AreEqual(ex.GetType(), typeof(ArgumentNullException)); } else { Assert.AreEqual(ex.GetType(), typeof(ArgumentException)); } } }