Пример #1
0
            public static void Assert01_02_03_15(AuthControllerTestRepository authControllerTestRepository,
                                                 HttpResponseMessage acualRessult)
            {
                Assert.Equal(HttpStatusCode.BadRequest, acualRessult.StatusCode);
                var result = JObject.Parse(acualRessult.Content.ReadAsStringAsync().Result);

                Assert.NotNull(result["traceId"]);
                Assert.Equal("One or more validation errors occurred.", result["title"]);
                Assert.Equal("400", result["status"]);
                var multiFactorAuthenticationLogFails =
                    authControllerTestRepository.GetMultiFactorAuthenticationLogFail();

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

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

                Assert.Empty(multiFactorAuthenticationStateDones);

                var radreplys = authControllerTestRepository.GetRadreplys("user1@jincreek2");

                Assert.Single(radreplys);
                Assert.Equal("Nw2Address", radreplys.First().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);
            }
Пример #3
0
            public static void Assert06(AuthControllerTestRepository authControllerTestRepository,
                                        HttpResponseMessage acualRessult)
            {
                Assert.Equal(HttpStatusCode.Unauthorized, acualRessult.StatusCode);
                var result = JObject.Parse(acualRessult.Content.ReadAsStringAsync().Result);

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

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

                Assert.Empty(multiFactorAuthenticationLogSuccesses);
                var multiFactorAuthenticationLogFails =
                    authControllerTestRepository.GetMultiFactorAuthenticationLogFail();

                Assert.Empty(multiFactorAuthenticationLogFails);
            }