コード例 #1
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);
            }
コード例 #2
0
            public static void Assert04_05_07_08_14_16_17_18_19_20(AuthControllerTestRepository authControllerTestRepository,
                                                                   HttpResponseMessage acutalRessult, MultiFactorAuthenticationRequest request)
            {
                Assert.Equal(HttpStatusCode.Unauthorized, acutalRessult.StatusCode);
                var result = JObject.Parse(acutalRessult.Content.ReadAsStringAsync().Result);

                Assert.Equal("1002", result["ErrorCode"]);
                Assert.Equal("Not Match MultiFactor Info", result["ErrorMessage"]);
                var multiFactorAuthenticationStateDones =
                    authControllerTestRepository.GetMultiFatorAuthenticationDone();

                Assert.Empty(multiFactorAuthenticationStateDones);
                var multiFactorAuthenticationLogSuccesses =
                    authControllerTestRepository.GetMultiFatorAuthenticationLogSuccess();

                Assert.Empty(multiFactorAuthenticationLogSuccesses);
                var simDeviceAuthenticationStateDone =
                    authControllerTestRepository.GetSimAndDeviceAuthenticated(request.AuthId);

                var multiFactorAuthenticationFailureLogs = authControllerTestRepository.GetMultiFactorAuthenticationFailureLogBySimAndDeviceId(
                    simDeviceAuthenticationStateDone.SimAndDevice.Id);

                Assert.NotEmpty(multiFactorAuthenticationFailureLogs);
                var radreplys =
                    authControllerTestRepository.GetRadreplys(simDeviceAuthenticationStateDone.SimAndDevice.Sim.UserName + "@" + simDeviceAuthenticationStateDone.SimAndDevice.Sim.SimGroup.UserNameSuffix);

                Assert.Single(radreplys);
                Assert.Equal(simDeviceAuthenticationStateDone.SimAndDevice.IsolatedNw2Ip, radreplys.First().Value);
            }