Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
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));
            }
        }
Exemplo n.º 3
0
        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));
                }
            }
        }