예제 #1
0
        public void ValidGetAclActionListTests(Params param, ValidValues value)
        {
            var request = new Dictionary <string, string>();

            if (value == ValidValues.MissingParam)
            {
                request.Remove(param.ToString());
            }
            else
            {
                ValidValuesMapper[value](param.ToString(), request);
            }

            var defaultManager = new DefaultManager();

            try
            {
                var response = defaultManager.Send <AclActionListResponse.ResponseItem>(Endpoint, request, HttpMethod.GET);
                PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode((int)System.Net.HttpStatusCode.OK));

                var actions = response.Result.Actions["0"]["117"][0];
                PrAssert.Equals(actions.ActionList.Category, "Mail");
                PrAssert.Equals(actions.ActionList.Target, "General");
                PrAssert.Equals(actions.ActionList.Type, "OpenMailbox");
                PrAssert.Equals(actions.ActionList.SubType, "");
                PrAssert.Equals(actions.ActionList.customActionId, "");
                PrAssert.Equals(actions.Label.En_Us.Value, "Open Mailbox");
                PrAssert.Equals(actions.Label.Ja.Value, "メールボックスを開く");
            }
            catch (System.Exception)
            {
                throw;
            }
        }
        public void ValidGetMethodCheckReturnJsonContentTypeTest()
        {
            var request = new Dictionary <string, string>()
            {
                ["resourceId"] = $"{(int)Utils.GetRandomResourceId(ValidResourceIds)}"
            };

            var MergeSettingManager = new MergeSettingsManager();
            var expectedContentType = "application/json";
            var result = MergeSettingManager.MergeSettings(request, string.Empty, HttpMethod.Get, expectedContentType);

            PrAssert.Equals(result.StatusCode, System.Net.HttpStatusCode.OK);
            PrAssert.Equals(result.Content.Headers.ContentType.MediaType, expectedContentType);
        }
예제 #3
0
        public void ValidEntryWithPostMethod(ValidCondition condition, ResourceId resource)
        {
            var entryManager = new EntryManager();
            var data         = PrepareData(condition, resource);
            var param        = new Dictionary <string, string>()
            {
                ["condition"] = data
            };

            var result = entryManager.GetEntryRecords <EntryResponse>(resource, param as object, HttpMethod.Post);

            PrAssert.That(result, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
            PrAssert.Equals(result.Result.Total, result.Result.Items.Length);
        }
예제 #4
0
        public void ValidGetRecentDataTests(Types type, Limits limit)
        {
            var defaultManager = new DefaultManager();
            var typeValue      = type.GetEnumAttributeValue <EnumMemberAttribute>("Value");
            var request        = new Dictionary <string, string>()
            {
                [Params.Type.ToString().ToLower()]  = typeValue,
                [Params.Limit.ToString().ToLower()] = VaidLimitMapper[limit].ToString()
            };

            var response = defaultManager.Send <List <GetRecentlyDataResponse> >(Endpoint, request, HttpMethod.GET);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode((int)System.Net.HttpStatusCode.OK));
            PrAssert.Equals(response.Result.Count, VaidLimitMapper[limit]);
            if (response.Result.Count != 0)
            {
                GetRecentlyDataResponse result = response.Result[0];
                checkResponseBody(type, result);
            }
        }
예제 #5
0
        public void checkResponseBody(Types type, GetRecentlyDataResponse response)
        {
            string iconOpenType       = "searchNewWindowLink";
            string openType           = "search";
            string permissionCategory = "General";
            string permissionTarget   = convertResouceNameToPermissionTarget(type);
            string permissionType     = openType.First().ToString().ToUpper() + openType.Substring(1);
            string recordId           = "";
            string label = "";
            string url   = $"/{type.GetEnumAttributeValue<EnumMemberAttribute>("Value")}";

            if (type == Types.Report)
            {
                recordId = ReportCreator.Data[0].Id.ToString();
                label    = ReportCreator.Data[0].Name;
                url      = url + $"/{recordId}";
            }
            else
            {
                recordId = searchResults.Data[type].Id.ToString();
                label    = searchResults.Data[type].Name;
                url      = url + $"/search/id/{recordId}";
            }

            PrAssert.Equals(response.Icon.OpenType, iconOpenType);
            PrAssert.Equals(response.Icon.PermissionType.Category, permissionCategory);
            PrAssert.Equals(response.Icon.PermissionType.Target, permissionTarget);
            PrAssert.Equals(response.Icon.PermissionType.Type, permissionType);
            PrAssert.Equals(response.Icon.Url, url);
            PrAssert.Equals(response.Label, label);
            PrAssert.Equals(response.OpenType, openType);
            PrAssert.Equals(response.PermissionTarget.Category, permissionCategory);
            PrAssert.Equals(response.PermissionTarget.Target, permissionTarget);
            PrAssert.Equals(response.PermissionTarget.Type, permissionType);
            PrAssert.Equals(response.Url, url);
        }