예제 #1
0
        public void ValidTests(ValidTypes type, ValidUsers user, ValidDepts dept, ValidDates start, ValidDates end, ValidOptions option)
        {
            var request = CreateGetRequest(TypeMapper[type], null, null);

            GenerateParamValues(TypeToResource[type], user, dept, start, end, option, request);
            TestPerform(request);
        }
예제 #2
0
        private void GenerateParamValues(ResourceType resourceType, ValidUsers user, ValidDepts dept, ValidDates start, ValidDates end, ValidOptions option, Dictionary <string, string> request)
        {
            var startDate = UnixDateMapper[start];
            var endDate   = UnixDateMapper[end];
            var opt       = user == ValidUsers.Admin ? AdminUserTestRecords.Data : NormalUserTestRecords.Data;
            var userType  = new Dictionary <ValidUsers, string>()
            {
                [ValidUsers.Admin]      = UserAdmin.ToString(),
                [ValidUsers.Normal]     = UserNormal.ToString(),
                [ValidUsers.ArrayUsers] = $"[{UserAdmin},{UserNormal}]"
            };
            var deptType = new Dictionary <ValidDepts, string>()
            {
                [ValidDepts.ExistedDept] = DefaultDeparment.ToString(),
                [ValidDepts.ArrayDepts]  = $"[{DefaultDeparment}, {NoneExistDepartment}]"
            };
            var optType = new Dictionary <ValidOptions, string>()
            {
                [ValidOptions.ExistedOption] = Options.Data[$"{resourceType}1"].Id.ToString(),
                [ValidOptions.ArrayOptions]  = $"[{Options.Data[$"{resourceType}1"].Id},{Options.Data[$"{resourceType}1"].Id}]"
            };

            request[ParamMapper[Params.Start]] = startDate.ToString();
            request[ParamMapper[Params.End]]   = endDate.ToString();
            if (user != ValidUsers.Missing)
            {
                request[ParamMapper[Params.User]] = userType[user];
            }
            if (dept != ValidDepts.Missing)
            {
                request[ParamMapper[Params.Dept]] = deptType[dept];
            }
            if (option != ValidOptions.Missing)
            {
                request[ParamMapper[Params.Option]] = optType[option];
            }
        }