public static void Assert09(AuthControllerTestRepository authControllerTestRepository, HttpResponseMessage acualRessult, DeauthenticationRequest request)
            {
                if (request == null)
                {
                    throw new ArgumentNullException(nameof(request));
                }
                Assert.Equal(HttpStatusCode.OK, acualRessult.StatusCode);
                Assert.Equal("", acualRessult.Content.ReadAsStringAsync().Result);

                //TODO
                //Debug.Assert(request.AuthId != null, "request.AuthId != null");
                //認証成功でSimDeviceAuthenticationStateDoneがなくなっているのでAuIdで探すのは無理
                var simDeviceList = authControllerTestRepository.GetSimDeviceList();

                Assert.Equal(3, simDeviceList.Count);

                var factorCombinationList = authControllerTestRepository.GetFactorCombinationList();

                Assert.Equal(2, factorCombinationList.Count);

                var multiFactorAuthenticationStateDones = authControllerTestRepository.GetMultiFatorAuthenticationDone();

                Assert.Equal(1, multiFactorAuthenticationStateDones.Count);

                var radreply = authControllerTestRepository.GetRadreply("user1@jincreek2");

                Assert.Equal("Nw2Address", radreply.Value);
            }
Exemplo n.º 2
0
            public override void AssertThat(AuthControllerTestRepository authControllerTestRepository, HttpResponseMessage acualRessult)
            {
                _testOutputHelper.WriteLine("12 AssertThat");
                Assert.Equal(HttpStatusCode.OK, acualRessult.StatusCode);
                var result = JObject.Parse(acualRessult.Content.ReadAsStringAsync().Result);

                Assert.Null(result["ErrorCode"]);
                Assert.Null(result["ErrorMessage"]);
                var isAuthenticateWhenScreenLock = result["IsAuthenticateWhenScreenLock"].ToObject <bool>();

                Assert.False(isAuthenticateWhenScreenLock);
                Assert.NotNull(result["AssignDeviceIpAddress"]);
                Assert.NotNull(result["AuthenticationDuration"]);
                var factorCombination = authControllerTestRepository.GetFactorCombination(_multiFactorAuthenticationRequest.Account, _multiFactorAuthenticationRequest.AuthId);

                Assert.NotNull(factorCombination);
                Assert.NotNull(factorCombination.MultiFactorAuthenticated);

                var multiFactorAuthenticationSuccessLogs = authControllerTestRepository.GetMultiFactorAuthenticationSuccessLogByMultiFactorId(factorCombination.Id);
                var multiFactorAuthenticationFailureLogs = authControllerTestRepository.GetMultiFactorAuthenticationFailureLogBySimAndDeviceId(factorCombination.SimAndDevice.Id);

                Assert.NotEmpty(multiFactorAuthenticationSuccessLogs);
                Assert.Empty(multiFactorAuthenticationFailureLogs);
                var testRadreply = authControllerTestRepository.GetRadreply(factorCombination.SimAndDevice.Sim.UserName + "@" + factorCombination.SimAndDevice.Sim.SimGroup.UserNameSuffix);

                Assert.Equal(factorCombination.ClosedNwIp, testRadreply.Value);
            }