public void InvalidSpecialTests(InvalidSpecial condition)
        {
            var userHandler = new UserManager("UnlockUser");
            var propDic     = new Dictionary <string, object>();

            InvalidSpecialMapper[condition](propDic);
            var connection = PrivateApiConnection.GetConnectionForCurrentTest();

            if (condition == InvalidSpecial.ExistedIdWithUserRole)
            {
                Login(connection, NormalUserIds[0].Company.Name, NormalUserIds[0].Login, NormalUserIds[0].Password);
            }
            else if (condition == InvalidSpecial.AlreadyUnlocked)
            {
                userHandler.Execute <UnlockUserResponse>(propDic, System.Net.Http.HttpMethod.Post);
            }
            else if (condition == InvalidSpecial.ErrorConnectDb)
            {
                connection.DeAuthenticate();
            }

            var result = userHandler.Execute <UnlockUserResponse>(propDic, System.Net.Http.HttpMethod.Post);

            PerformTest(result, condition.ToString());
        }
示例#2
0
        public void InvalidSpecialCreatePdfTest(InvalidSpecial invalid)
        {
            var request        = CreatePdfRequest(invalid.ToString().Contains("Content") ? "pdf_file.pdf" : invalid.GetEnumStringValue(), CreatePdfTestCase.GenerateFoXmlFormatContent(ValidTemplate.Empty), "-1");
            var defaultManager = new DefaultManager();
            var response       = defaultManager.Send <CreatePdfResponse>(CreatePdfTestCase.CreatePdfEndpoint, request.ToJson(), HttpMethod.POST);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
示例#3
0
        public void PasswordInvalidSpecialTests(InvalidSpecial inputValue)
        {
            var requestDic  = InvalidSpecialMapper[inputValue];
            var passwordMng = new ResetPasswordManager();
            var response    = passwordMng.ResetPassword <ResetPasswordResponse>(requestDic, HttpMethod.Post);

            PrAssert.That(response, PrIs.ErrorResponse().With.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
        public void InvalidSpecialMatchingSearchTest(InvalidSpecial invalid)
        {
            var request = MatchingSearchRequest($"{RecordsCreator.Data[$"{ResourceId.Job}{0}"].Id}", $"{ResourceId.Job.ToString().ToLower()}");

            MatchingSearchTestCase.InvalidSpecialValueMapper[invalid](request, 0, 0);
            var defaultManager = new DefaultManager();
            var response       = defaultManager.Send <object>(MatchingSearchTestCase.MatchingSearchEndpoint, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest));
        }
示例#5
0
        public void ConfigurationServiceInvalidSpecialTest(InvalidSpecial inputType, Method method)
        {
            var request = GetParameters[inputType](method);
            var handler = new ConfigurationServiceManager();
            ApiResponse <object> response = null;

            if (method == Method.Create)
            {
                var contentType = inputType == InvalidSpecial.WrongContentType ? "text/html" : "application/json";
                response = handler.ConfigurationService <object>(request["service"], request["id"], request["body"], System.Net.Http.HttpMethod.Put, contentType);
            }
            else
            {
                response = handler.ConfigurationService <object>(request["service"], request["id"], System.Net.Http.HttpMethod.Get);
            }
            PrAssert.That(response, PrIs.ErrorResponse());
        }