Пример #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);
            }
            //public static void Assert04(AuthControllerTestRepository authControllerTestRepository, HttpResponseMessage acualRessult)
            //{
            //    Assert.Equal(HttpStatusCode.Unauthorized, acualRessult.StatusCode);
            //    var result = JObject.Parse(acualRessult.Content.ReadAsStringAsync().Result);
            //    Assert.Equal("1001", result["ErrorCode"]);
            //    Assert.Equal("Not Match SimAndDevice Info", result["ErrorMessage"]);
            //    var deauthentication = authControllerTestRepository.GetDeauthentication();
            //    Assert.Empty(deauthentication);
            //    var simDeviceAuthenticationStateDones = authControllerTestRepository.GetSimAndDeviceAuthenticated();
            //    Assert.Empty(simDeviceAuthenticationStateDones);
            //    var multiFactorAuthenticationStateDones = authControllerTestRepository.GetMultiFatorAuthenticationDone();
            //    Assert.Empty(multiFactorAuthenticationStateDones);
            //    var radreply = authControllerTestRepository.GetRadreplys("user1@jincreek2");
            //    Assert.Single(radreply);
            //    Assert.Equal("NwAddress", radreply.First().Value);
            //}

            //public static void Assert05(AuthControllerTestRepository authControllerTestRepository, HttpResponseMessage acualRessult)
            //{
            //    Assert.Equal(HttpStatusCode.Unauthorized, acualRessult.StatusCode);
            //    var result = JObject.Parse(acualRessult.Content.ReadAsStringAsync().Result);
            //    Assert.Equal("1001", result["ErrorCode"]);
            //    Assert.Equal("Not Match SimAndDevice Info", result["ErrorMessage"]);
            //    var deauthentication = authControllerTestRepository.GetDeauthentication();
            //    Assert.Empty(deauthentication);
            //    var simDeviceAuthenticationStateDones = authControllerTestRepository.GetSimAndDeviceAuthenticated();
            //    // 関連ないSimDeviceAuthenticationStateDoneを入れているのでcount=1を確認
            //    Assert.Equal(1, simDeviceAuthenticationStateDones.Count);
            //    var multiFactorAuthenticationStateDones = authControllerTestRepository.GetMultiFatorAuthenticationDone();
            //    Assert.Empty(multiFactorAuthenticationStateDones);
            //    var radreply = authControllerTestRepository.GetRadreplys("user1@jincreek2");
            //    Assert.Single(radreply);
            //    Assert.Equal("NwAddress", radreply.First().Value);
            //}

            public static void Assert06To07(AuthControllerTestRepository authControllerTestRepository, HttpResponseMessage acualRessult)
            {
                Assert.Equal(HttpStatusCode.OK, acualRessult.StatusCode);
                Assert.Equal("", acualRessult.Content.ReadAsStringAsync().Result);
                //var result = JObject.Parse(acualRessult.Content.ReadAsStringAsync().Result);
                //Assert.Equal("1002", result["ErrorCode"]);
                //Assert.Equal("Not Match MultiFactor Info", result["ErrorMessage"]);
                var deauthentication = authControllerTestRepository.GetDeauthentication();

                Assert.Empty(deauthentication);
                var simDeviceAuthenticationStateDones = authControllerTestRepository.GetAllSimAndDeviceAuthenticated();

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

                Assert.Empty(multiFactorAuthenticationStateDones);
                var radreply = authControllerTestRepository.GetRadreplys("user1@jincreek2");

                Assert.Single(radreply);
                Assert.Equal("Nw2Address", radreply.First().Value);
            }
            public static void Assert01And02And10To21(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 deauthentication = authControllerTestRepository.GetDeauthentication();

                Assert.Empty(deauthentication);

                var simDeviceAuthenticationStateDones = authControllerTestRepository.GetAllSimAndDeviceAuthenticated();

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

                Assert.Empty(multiFactorAuthenticationStateDones);
                var radreply = authControllerTestRepository.GetRadreplys("user1@jincreek2");

                Assert.Single(radreply);
                Assert.Equal("NwAddress", radreply.First().Value);
            }